From 08fc0906c011f8c1b23504f0f2d7956bcb439542 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leon=20B=C3=B6sche?= Date: Sun, 25 Jan 2026 03:23:59 +0100 Subject: [PATCH] Add range request support to publicFileViewHandler for video/audio seeking --- go_cloud/internal/http/routes.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/go_cloud/internal/http/routes.go b/go_cloud/internal/http/routes.go index f1f96eb..3a4f132 100644 --- a/go_cloud/internal/http/routes.go +++ b/go_cloud/internal/http/routes.go @@ -3175,7 +3175,7 @@ func publicFileViewHandler(w http.ResponseWriter, r *http.Request, db *database. } // Stream file - resp, err := client.Download(r.Context(), file.Path, "") + resp, err := client.Download(r.Context(), file.Path, r.Header.Get("Range")) if err != nil { errors.LogError(r, err, "Failed to download file") errors.WriteError(w, errors.CodeInternal, "Server error", http.StatusInternalServerError) @@ -3188,6 +3188,9 @@ func publicFileViewHandler(w http.ResponseWriter, r *http.Request, db *database. w.Header().Set("Access-Control-Allow-Methods", "GET, HEAD, OPTIONS") w.Header().Set("Access-Control-Allow-Headers", "Range") + // Set status code (200 or 206 for partial) + w.WriteHeader(resp.StatusCode) + // Copy headers from Nextcloud response, but skip Content-Type to ensure correct MIME type for k, v := range resp.Header { if k != "Content-Type" {