try again

This commit is contained in:
2026-01-12 15:55:19 +11:00
parent b6de489be7
commit 2ecfb853db

View File

@@ -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)) 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. // 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) encodedURL := url.QueryEscape(base)
redirect := fmt.Sprintf("%s/?splash=0&ui=min&libs=aws4", drawioBaseURL) redirect := fmt.Sprintf("%s/?splash=0&ui=min&libs=aws4&url=%s#U%s", drawioBaseURL, encodedURL, encodedURL)
// Also embed the XML directly via `data=` so self-hosted instances that block remote fetches can still open it. _ = xml // kept for signature compatibility; may be used in future fallbacks
if xml != "" { return redirect
data := base64.StdEncoding.EncodeToString([]byte(xml))
redirect += "&data=" + url.QueryEscape(data)
}
return fmt.Sprintf("%s#U%s", redirect, encodedURL)
} }
func addCORS(w http.ResponseWriter) { func addCORS(w http.ResponseWriter) {