Skip to content
This repository has been archived by the owner on Sep 27, 2024. It is now read-only.

Commit

Permalink
fix: file constraint now checks file is not a directory
Browse files Browse the repository at this point in the history
  • Loading branch information
lbarraga committed May 23, 2024
1 parent e35aa6a commit 5e8250a
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import os
from pathlib import Path

from pydantic import BaseModel
Expand All @@ -11,9 +10,9 @@ class FileConstraint(BaseModel):
file_name: str

def validate_constraint(self, path: Path) -> FileConstraintResult:
directory = os.listdir(path)
file_path = path / self.file_name

if self.file_name not in directory:
if not file_path.exists() or file_path.is_dir():
return FileConstraintResult(
file_name=self.file_name,
is_ok=False,
Expand Down

0 comments on commit 5e8250a

Please sign in to comment.