fix: PDF viewer - wire up _render_file_viewer + URL-encode filenames
FlowDeck CI / test (push) Failing after 5s
FlowDeck CI / docker (push) Has been skipped

- 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:
2026-07-18 09:34:24 -04:00
parent bd02c9ea8a
commit 2534e2b425
2 changed files with 10 additions and 3 deletions
+2 -1
View File
@@ -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