Add debug logging for X-WOPI-SuggestedTarget header and URL-encode WOPISrc in Collabora URL

This commit is contained in:
Leon Bösche
2026-02-05 12:38:12 +01:00
parent 425ac0c99e
commit 9eac0fe178
2 changed files with 5 additions and 1 deletions

Binary file not shown.

View File

@@ -561,6 +561,7 @@ func wopiPutFileHandler(w http.ResponseWriter, r *http.Request, db *database.DB,
defer r.Body.Close()
// Check for suggested target (used for export operations like Save as PDF)
suggestedTarget := r.Header.Get("X-WOPI-SuggestedTarget")
fmt.Printf("[WOPI-EXPORT] X-WOPI-SuggestedTarget header: '%s'\n", suggestedTarget)
isExport := suggestedTarget != ""
var targetFile *database.File
@@ -877,8 +878,11 @@ func collaboraProxyHandler(w http.ResponseWriter, r *http.Request, db *database.
// Get the correct Collabora editor URL from discovery (includes version hash)
editorURL := getCollaboraEditorURL(collaboraURL)
// URL-encode the WOPISrc for use in the form action URL (Collabora requires this)
encodedWopiSrc := url.QueryEscape(wopiSrc)
// Build the full Collabora URL with WOPISrc as query parameter
collaboraFullURL := fmt.Sprintf("%s?WOPISrc=%s", editorURL, wopiSrc)
collaboraFullURL := fmt.Sprintf("%s?WOPISrc=%s", editorURL, encodedWopiSrc)
// Return HTML page with auto-submitting form
// The form POSTs to Collabora with access_token in the body