mirror of
https://github.com/Garmelon/PFERD.git
synced 2025-07-12 14:12:30 +02:00
Use Python facilities to convert paths to file:// urls
This commit is contained in:
@ -22,6 +22,9 @@ ambiguous situations.
|
|||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
|
## Fixed
|
||||||
|
- File links in report on Windows
|
||||||
|
|
||||||
## 3.7.0 - 2024-11-13
|
## 3.7.0 - 2024-11-13
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
from pathlib import Path, PurePath
|
from pathlib import Path, PurePath
|
||||||
from typing import Dict, List, Optional
|
from typing import Dict, List, Optional
|
||||||
from urllib.parse import quote
|
|
||||||
|
|
||||||
from rich.markup import escape
|
from rich.markup import escape
|
||||||
|
|
||||||
@ -171,7 +170,7 @@ class Pferd:
|
|||||||
|
|
||||||
def fmt_path_link(relative_path: PurePath) -> str:
|
def fmt_path_link(relative_path: PurePath) -> str:
|
||||||
# We need to URL-encode the path because it might contain spaces or special characters
|
# 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()))}"
|
link = crawler.output_dir.resolve(relative_path).absolute().as_uri()
|
||||||
return f"[link={link}]{fmt_path(relative_path)}[/link]"
|
return f"[link={link}]{fmt_path(relative_path)}[/link]"
|
||||||
|
|
||||||
something_changed = False
|
something_changed = False
|
||||||
|
Reference in New Issue
Block a user