From e9e3af133136174120579eb16d1618402be8eaec Mon Sep 17 00:00:00 2001 From: Arnab Nandy Date: Fri, 17 Jul 2026 23:41:39 +0530 Subject: [PATCH 1/2] feat: improve inline file viewing Signed-off-by: Arnab Nandy --- README.md | 26 +++++++++++++++++- .../cloudpage/controller/FileController.java | 21 ++++++++++----- .../controller/FileControllerTest.java | 27 +++++++++++++++++-- 3 files changed, 64 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 0d9b4a03..760b1eed 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,30 @@ GET /api/folders/search?folderPath=/&query=report&type=file&minSize=1024&sortBy= --- +## Inline file viewing + +`GET /api/files/view?path=` serves a file for display in the browser. The +response keeps the file's detected MIME type, uses `Content-Disposition: inline`, and supports +HTTP byte-range requests for seeking in video, audio, and PDF files. Unknown file types use +`application/octet-stream`, allowing the client to show a download fallback. + +The endpoint uses the same authenticated user root and path validation as the other file APIs. +Viewer actions can reuse the existing endpoints: + +| Action | Endpoint | +|-------|----------| +| Rename or move | `PATCH /api/files/move?filePath=&newPath=` | +| Delete (move to trash) | `DELETE /api/files?filePath=` | +| Download | `GET /api/files/download?path=` | +| Next/previous source list | `GET /api/folders/content?path=&page=&size=` | + +All requests require the existing bearer-token authentication. A frontend using native +`