Explorar o código

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

Jakob Borg %!s(int64=2) %!d(string=hai) anos
pai
achega
a405c21ebb
Modificáronse 1 ficheiros con 4 adicións e 2 borrados
  1. 4 2
      cmd/stdiscosrv/apisrv.go

+ 4 - 2
cmd/stdiscosrv/apisrv.go

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