Skip to content

Commit 7d3be8b

Browse files
authored
Merge pull request #308 from DigitalSlideArchive/allow-missing-rules
From the GUI, allow missing rules
2 parents dae9037 + b479552 commit 7d3be8b

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

imagedephi/gui/api/api.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,10 @@ def get_redaction_plan(
142142
raise HTTPException(status_code=404, detail="Input directory not found")
143143

144144
# TODO: Add support for multiple input directories in the UI
145+
if rules_path and not Path(rules_path).is_file():
146+
rules_path = None
147+
print("Rules file not found")
145148
if rules_path:
146-
if not Path(rules_path).exists():
147-
raise HTTPException(status_code=404, detail="Rules file not found")
148149
return show_redaction_plan(
149150
[input_path], override_rules=Path(rules_path), limit=limit, offset=offset, update=update
150151
)._asdict()
@@ -164,7 +165,9 @@ def redact(
164165
raise HTTPException(status_code=404, detail="Input directory not found")
165166
if not output_path.is_dir():
166167
raise HTTPException(status_code=404, detail="Output directory not found")
167-
168+
if rules_path is not None and not Path(rules_path).is_file():
169+
rules_path = None
170+
print("Rules file not found")
168171
# TODO: Add support for multiple input directories in the UI
169172
if rules_path:
170173
redact_images([input_path], output_path, override_rules=Path(rules_path))

0 commit comments

Comments
 (0)