(scan: sqlite3.Row, value: str)
| 2775 | |
| 2776 | |
| 2777 | def require_scan_relative_file(scan: sqlite3.Row, value: str) -> str: |
| 2778 | normalized = optional_text(value, maximum=4096) |
| 2779 | if normalized is None or "\\" in normalized: |
| 2780 | raise SystemExit("Patch path must identify a scan-local regular file.") |
| 2781 | parsed = PurePosixPath(normalized) |
| 2782 | if parsed.is_absolute() or ".." in parsed.parts: |
| 2783 | raise SystemExit("Patch path must identify a scan-local regular file.") |
| 2784 | path = artifact_path(Path(scan["scan_dir"]), parsed.as_posix(), required=True) |
| 2785 | if path is None: |
| 2786 | raise SystemExit("Patch path must identify a scan-local regular file.") |
| 2787 | return parsed.as_posix() |
| 2788 | |
| 2789 | |
| 2790 | def require_matching_patch_digest(scan: sqlite3.Row, patch_path: str, patch_digest: str) -> None: |
no test coverage detected