update
This commit is contained in:
17
backend/paths.py
Normal file
17
backend/paths.py
Normal file
@@ -0,0 +1,17 @@
|
||||
from pathlib import Path
|
||||
|
||||
from config import STORAGE_DIR
|
||||
|
||||
|
||||
def safe_basename(topic: str, format_name: str) -> str:
|
||||
clean = topic.replace("/", "_").replace("\x00", "")
|
||||
return f"{clean} - {format_name}"
|
||||
|
||||
|
||||
def final_paths(topic: str, format_name: str) -> tuple[Path, Path]:
|
||||
base = safe_basename(topic, format_name)
|
||||
return STORAGE_DIR / "html" / f"{base}.html", STORAGE_DIR / "pdf" / f"{base}.pdf"
|
||||
|
||||
|
||||
def temp_paths(guide_id: str) -> tuple[Path, Path]:
|
||||
return STORAGE_DIR / "html" / f"{guide_id}.tmp.html", STORAGE_DIR / "pdf" / f"{guide_id}.tmp.pdf"
|
||||
Reference in New Issue
Block a user