]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
datamodel: types: FilePath strict validation fix
authorAleš Mrázek <ales.mrazek@nic.cz>
Mon, 18 Sep 2023 22:35:10 +0000 (00:35 +0200)
committerOto Šťáva <oto.stava@nic.cz>
Mon, 25 Sep 2023 10:58:17 +0000 (12:58 +0200)
manager/knot_resolver_manager/datamodel/types/files.py

index 6244a6d37dd798914e9b6161604128ed33e46f21..dd516358754faec2d58511287554a838b568c44c 100644 (file)
@@ -132,7 +132,7 @@ class FilePath(UncheckedPath):
     ) -> None:
         super().__init__(source_value, parents=parents, object_path=object_path)
         p = self._value.parent
-        if self.strict_validation and not p.exists() or not p.is_dir():
+        if self.strict_validation and (not p.exists() or not p.is_dir()):
             raise ValueError(f"path '{self._value}' does not point inside an existing directory")
         if self.strict_validation and self._value.is_dir():
             raise ValueError(f"path '{self._value}' points to a directory when we expected a file")