From c34cde519a4b7f647ba82513993be6bad0ec7108 Mon Sep 17 00:00:00 2001 From: I-Al-Istannen Date: Mon, 4 Nov 2024 00:16:36 +0100 Subject: [PATCH] url-encode paths in report linking --- CHANGELOG.md | 1 + PFERD/pferd.py | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3926f7a..c6c9cb9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ ambiguous situations. ### Added - Support for MOB videos in page descriptions +- Clickable links in the report to directly open new/modified/not-deleted files ### Changed - Remove videos from description pages diff --git a/PFERD/pferd.py b/PFERD/pferd.py index 3ec459d..850e68e 100644 --- a/PFERD/pferd.py +++ b/PFERD/pferd.py @@ -1,5 +1,6 @@ from pathlib import Path, PurePath from typing import Dict, List, Optional +from urllib.parse import quote from rich.markup import escape @@ -169,7 +170,8 @@ class Pferd: log.report(f"[bold bright_cyan]Report[/] for {escape(name)}") def fmt_path_link(relative_path: PurePath) -> str: - link = f"file://{crawler.output_dir.resolve(relative_path).absolute()}" + # 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()))}" return f"[link={link}]{fmt_path(relative_path)}[/link]" something_changed = False