diff options
| author | Dennis Fink | 2026-10-30 20:17:21 +0100 |
|---|---|---|
| committer | Dennis Fink | 2026-10-30 20:17:21 +0100 |
| commit | 8c561e702ed15022b17eae81e4185448c021e1cb (patch) | |
| tree | 3397ecddde081a43a59e5f7e1324eefed29d7a1a | |
| parent | 8fd569c6c0a39761f7ddda3c6e145d90534b4300 (diff) | |
| download | webmentions-ssg-8c561e702ed15022b17eae81e4185448c021e1cb.tar.gz webmentions-ssg-8c561e702ed15022b17eae81e4185448c021e1cb.zip | |
fix(sender): validate missing source directories
Resolve configured source paths without requiring them to exist first so
missing directories produce the scanner's explicit directory validation
error instead of leaking a lower-level path resolution exception.
Diffstat (limited to '')
| -rw-r--r-- | tests/tasks/test_scanner.py | 10 | ||||
| -rw-r--r-- | webmentions_ssg/tasks/scanner.py | 2 |
2 files changed, 11 insertions, 1 deletions
diff --git a/tests/tasks/test_scanner.py b/tests/tasks/test_scanner.py index 7aefff4..5a1e5f2 100644 --- a/tests/tasks/test_scanner.py +++ b/tests/tasks/test_scanner.py @@ -2297,6 +2297,16 @@ def test_scan_sources_returns_when_source_directory_is_not_configured( assert db.session.scalar(sa.select(Source)) is None +def test_scan_sources_rejects_missing_source_directory( + app: Flask, scanner_module: ModuleType, tmp_path: Path +) -> None: + path = tmp_path / "missing" + configure_scanner(app, path) + + with pytest.raises(RuntimeError, match="Source directory is not a directory"): + run_scan(app, scanner_module) + + def test_scan_sources_rejects_source_directory_that_is_not_directory( app: Flask, scanner_module: ModuleType, tmp_path: Path ) -> None: diff --git a/webmentions_ssg/tasks/scanner.py b/webmentions_ssg/tasks/scanner.py index 68c35be..e45085d 100644 --- a/webmentions_ssg/tasks/scanner.py +++ b/webmentions_ssg/tasks/scanner.py @@ -503,7 +503,7 @@ def scan_sources_task() -> None: if directory is None: return - root = Path(directory).expanduser().resolve(strict=True) + root = Path(directory).expanduser().resolve() if not root.is_dir(): raise RuntimeError(f"Source directory is not a directory: {root}") |
