Merge: patentstyle Content-Disposition derives filename from requested file (HLC install fix)
This commit is contained in:
@@ -26,14 +26,20 @@ func noCacheAssets(h http.Handler) http.Handler {
|
||||
})
|
||||
}
|
||||
|
||||
// patentstyleDownload sets a Content-Disposition with the spaced filename
|
||||
// "HL Patents Style.dotm" for .dotm requests under /patentstyle/. The URL
|
||||
// path stays clean (dashes), browsers and download tools land the file
|
||||
// with the name PAs expect to see.
|
||||
// patentstyleDownload sets a Content-Disposition with a spaced filename
|
||||
// for .dotm requests under /patentstyle/, derived from the ACTUAL
|
||||
// requested file (dashes→spaces). The URL path stays clean (dashes),
|
||||
// browsers and download tools land the file with the spaced name PAs
|
||||
// expect to see — and, crucially, the name that the template's install
|
||||
// macro checks against (TEMPLATE_CHECK). Hardcoding the old "HL Patents
|
||||
// Style.dotm" made the rebranded HLC-Patents-Style.dotm save under the
|
||||
// wrong name, so its install macro rejected it (work/paliad 2026-06-01).
|
||||
func patentstyleDownload(h http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
if strings.HasSuffix(r.URL.Path, ".dotm") {
|
||||
w.Header().Set("Content-Disposition", `attachment; filename="HL Patents Style.dotm"`)
|
||||
base := r.URL.Path[strings.LastIndex(r.URL.Path, "/")+1:]
|
||||
name := strings.ReplaceAll(base, "-", " ")
|
||||
w.Header().Set("Content-Disposition", `attachment; filename="`+name+`"`)
|
||||
}
|
||||
h.ServeHTTP(w, r)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user