Refactor WOPI handlers to remove debug logging and streamline access token usage
This commit is contained in:
BIN
go_cloud/api
BIN
go_cloud/api
Binary file not shown.
@@ -340,7 +340,6 @@ func wopiGetFileHandler(w http.ResponseWriter, r *http.Request, db *database.DB,
|
||||
|
||||
// Get access token from query parameter
|
||||
accessToken := r.URL.Query().Get("access_token")
|
||||
fmt.Printf("[WOPI-GetFile] Access token from query: '%s'\n", accessToken)
|
||||
if accessToken == "" {
|
||||
errors.WriteError(w, errors.CodeUnauthenticated, "Missing access_token", http.StatusUnauthorized)
|
||||
return
|
||||
@@ -534,11 +533,9 @@ func wopiPutFileHandler(w http.ResponseWriter, r *http.Request, db *database.DB,
|
||||
return
|
||||
}
|
||||
defer r.Body.Close()
|
||||
fmt.Printf("[WOPI-STORAGE] Read content: %d bytes\n", len(content))
|
||||
// Check for suggested target (used for export operations like Save as PDF)
|
||||
suggestedTarget := r.Header.Get("X-WOPI-SuggestedTarget")
|
||||
isExport := suggestedTarget != ""
|
||||
fmt.Printf("[WOPI-PutFile] Suggested target: '%s', isExport: %v\n", suggestedTarget, isExport)
|
||||
|
||||
var targetFile *database.File
|
||||
var targetRemotePath string
|
||||
@@ -848,10 +845,8 @@ func collaboraProxyHandler(w http.ResponseWriter, r *http.Request, db *database.
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Printf("[COLLABORA-PROXY] Generated access token: %s\n", accessToken)
|
||||
|
||||
// Build WOPISrc URL (with access_token as query parameter)
|
||||
wopiSrc := fmt.Sprintf("https://go.b0esche.cloud/wopi/files/%s?access_token=%s", fileID, url.QueryEscape(accessToken))
|
||||
wopiSrc := fmt.Sprintf("https://go.b0esche.cloud/wopi/files/%s?access_token=%s", fileID, accessToken)
|
||||
|
||||
// Get the correct Collabora editor URL from discovery (includes version hash)
|
||||
editorURL := getCollaboraEditorURL(collaboraURL)
|
||||
@@ -902,6 +897,4 @@ func collaboraProxyHandler(w http.ResponseWriter, r *http.Request, db *database.
|
||||
// Don't set X-Frame-Options - this endpoint is meant to be loaded in an iframe
|
||||
w.WriteHeader(http.StatusOK)
|
||||
w.Write([]byte(htmlContent))
|
||||
|
||||
fmt.Printf("[COLLABORA-PROXY] Served HTML form: file=%s user=%s wopi_src=%s editor_url=%s\n", fileID, userID.String(), wopiSrc, collaboraFullURL)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user