fix: decode URL-encoded filename from contentDisposition header (#1099)

This commit is contained in:
Krau authored and GitHub committed 2025-09-04 18:22:30 +08:00
1 parent 55e6bdc4f7
commit cfdcb586ee
3 files changed
+34 -2

No files matched your search

+10
View File
@@ -56,3 +56,13 @@ func ProxyUrlToHandler(proxyUrl *url.URL) func(*http.Request) (*url.URL, error)
}
return http.ProxyURL(proxyUrl)
}
// TryUrlQueryUnescape tries to unescape a URL-encoded string.
//
// If unescaping fails, it returns the original string.
func TryUrlQueryUnescape(s string) string {
if decoded, err := url.QueryUnescape(s); err == nil {
return decoded
}
return s
}