From 509983b4ffcee88068f2b7a2c434d920fce3a906 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leon=20B=C3=B6sche?= Date: Mon, 12 Jan 2026 16:58:39 +0100 Subject: [PATCH] Fix: Update Collabora proxy to load editor in iframe with WOPISrc in query string --- go_cloud/internal/http/wopi_handlers.go | 57 ++++++++++++++----------- 1 file changed, 31 insertions(+), 26 deletions(-) diff --git a/go_cloud/internal/http/wopi_handlers.go b/go_cloud/internal/http/wopi_handlers.go index 77699a3..aafb1c9 100644 --- a/go_cloud/internal/http/wopi_handlers.go +++ b/go_cloud/internal/http/wopi_handlers.go @@ -5,6 +5,7 @@ import ( "fmt" "io" "net/http" + "net/url" "strings" "sync" "time" @@ -663,47 +664,51 @@ func collaboraProxyHandler(w http.ResponseWriter, r *http.Request, db *database. // Build WOPISrc URL wopiSrc := fmt.Sprintf("https://go.b0esche.cloud/wopi/files/%s?access_token=%s", fileID, accessToken) - // Return HTML page with auto-submitting form - // Collabora requires: POST to /loleaflet/dist/loleaflet.html with WOPISrc in request body + // Build Collabora editor URL with WOPISrc in query string + editorURL := fmt.Sprintf("%s/loleaflet/dist/loleaflet.html?WOPISrc=%s&closebutton=1", collaboraURL, url.QueryEscape(wopiSrc)) + + // Return HTML page that loads Collabora in an iframe htmlContent := fmt.Sprintf(` Loading Document... -
-
Loading document in Collabora Online...
+
+
+

Loading Collabora Online...

+
+
- - -`, collaboraURL, wopiSrc) +`, editorURL, editorURL) w.Header().Set("Content-Type", "text/html; charset=utf-8") // Don't set X-Frame-Options - this endpoint is meant to be loaded in an iframe