Strip long path prefix from file links in report

This commit is contained in:
I-Al-Istannen
2024-11-14 20:06:13 +01:00
parent 287173b0b1
commit 4af02012bc

View File

@ -171,7 +171,9 @@ class Pferd:
def fmt_path_link(relative_path: PurePath) -> str:
# We need to URL-encode the path because it might contain spaces or special characters
link = f"file://{quote(str(crawler.output_dir.resolve(relative_path).absolute()))}"
absolute_path = str(crawler.output_dir.resolve(relative_path).absolute())
absolute_path = absolute_path.replace("\\\\?\\", "")
link = f"file://{quote(absolute_path)}"
return f"[link={link}]{fmt_path(relative_path)}[/link]"
something_changed = False