cmd/stdiscosrv: Only attempt unescaping when there are %-encodings in the header (fixes #9143)

This commit is contained in:
Jakob Borg 2023-10-14 12:29:53 +02:00
parent dc6a10dff4
commit a405c21ebb

View File

@ -360,8 +360,10 @@ func certificateBytes(req *http.Request) ([]byte, error) {
// statements. We need to decode, reinstate the newlines every 64 // statements. We need to decode, reinstate the newlines every 64
// character and add statements for the PEM decoder // character and add statements for the PEM decoder
if unesc, err := url.QueryUnescape(hdr); err == nil { if strings.Contains(hdr, "%") {
hdr = unesc if unesc, err := url.QueryUnescape(hdr); err == nil {
hdr = unesc
}
} }
for i := 64; i < len(hdr); i += 65 { for i := 64; i < len(hdr); i += 65 {