diff --git a/cmd/server/main.go b/cmd/server/main.go index 3e61d41..02e4f22 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -341,15 +341,12 @@ func buildDiagramsNetURL(r *http.Request, id string, xml string) string { } base := fmt.Sprintf("%s://%s/diagram?id=%s", scheme, r.Host, url.QueryEscape(id)) // Request AWS library for custom shapes (e.g., aws4) to render correctly. - // Use the fragment form (#U) to point at a downloadable URL. + // Provide both query param (url=) and fragment (#U) so different draw.io deployments can fetch the diagram. + // We intentionally avoid embedding the XML inline to keep headers small for Tomcat-based self-hosted instances. encodedURL := url.QueryEscape(base) - redirect := fmt.Sprintf("%s/?splash=0&ui=min&libs=aws4", drawioBaseURL) - // Also embed the XML directly via `data=` so self-hosted instances that block remote fetches can still open it. - if xml != "" { - data := base64.StdEncoding.EncodeToString([]byte(xml)) - redirect += "&data=" + url.QueryEscape(data) - } - return fmt.Sprintf("%s#U%s", redirect, encodedURL) + redirect := fmt.Sprintf("%s/?splash=0&ui=min&libs=aws4&url=%s#U%s", drawioBaseURL, encodedURL, encodedURL) + _ = xml // kept for signature compatibility; may be used in future fallbacks + return redirect } func addCORS(w http.ResponseWriter) {