(filename: str, source_image: Path)
| 55 | |
| 56 | |
| 57 | def safe_image_filename(filename: str, source_image: Path) -> str: |
| 58 | candidate = filename.strip() or source_image.name |
| 59 | if ( |
| 60 | not candidate |
| 61 | or candidate in {".", ".."} |
| 62 | or "/" in candidate |
| 63 | or "\\" in candidate |
| 64 | or Path(candidate).is_absolute() |
| 65 | ): |
| 66 | raise SystemExit(f"Unsafe figure image filename in insert decision: {candidate}") |
| 67 | return candidate |
| 68 | |
| 69 | |
| 70 | def embed_target_matches(target: str, expected_relative: str) -> bool: |
no outgoing calls
no test coverage detected