refactor: add public URL handling for SurfSense documents across various components and schemas

This commit is contained in:
Anish Sarkar 2026-05-15 02:05:11 +05:30
parent ea087d1d23
commit 01d7379914
8 changed files with 35 additions and 8 deletions

View file

@ -0,0 +1,13 @@
"""Utilities for SurfSense's built-in documentation index."""
from pathlib import PurePosixPath
DOCS_PUBLIC_ROOT = PurePosixPath("/docs")
def surfsense_docs_public_url(source: str) -> str:
"""Return the public docs route for an indexed documentation source path."""
docs_path = PurePosixPath(source).with_suffix("")
if docs_path.name == "index":
docs_path = docs_path.parent
return (DOCS_PUBLIC_ROOT / docs_path).as_posix()