fix: PDF viewer - wire up _render_file_viewer + URL-encode filenames
- view_page now calls _render_file_viewer for content_format='file' pages instead of rendering the full page_editor template (which was the old path) - URL-encode filenames in file_url using urllib.parse.quote() to handle spaces and special characters correctly - Fixed in both board.py (viewer + page_data) and dashboard.py The _render_file_viewer was dead code — defined but never called. File pages were going through page_editor.html which rendered PDFs in an iframe embedded in the editor UI. Now they get a clean standalone HTML viewer.
This commit is contained in:
@@ -270,7 +270,8 @@ async def view_page_root(request: Request, page_id: int):
|
||||
ws_id = p.replace("workspace_", "")
|
||||
break
|
||||
filename = fp_parts[-1] if fp_parts else page.get("title", "File")
|
||||
file_url = f"/api/files/{ws_id}/{filename}" if ws_id else ""
|
||||
from urllib.parse import quote
|
||||
file_url = f"/api/files/{ws_id}/{quote(filename, safe='')}" if ws_id else ""
|
||||
page_data["file_url"] = file_url
|
||||
page_data["file_mime"] = mime_type
|
||||
page_data["file_size"] = file_size
|
||||
|
||||
Reference in New Issue
Block a user