aboutsummaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorJakob Borg <jakob@kastelo.net>2023-10-14 12:29:53 +0200
committerJakob Borg <jakob@kastelo.net>2023-10-14 12:30:29 +0200
commita405c21ebba3e395a221d91e6654a269e83cdc02 (patch)
treecac011f46c515ed51797056447a747d66a577e59 /cmd
parentdc6a10dff4bddab178118cc0e32a56925118293b (diff)
downloadsyncthing-a405c21ebba3e395a221d91e6654a269e83cdc02.tar.gz
syncthing-a405c21ebba3e395a221d91e6654a269e83cdc02.zip
cmd/stdiscosrv: Only attempt unescaping when there are %-encodings in the header (fixes #9143)
Diffstat (limited to 'cmd')
-rw-r--r--cmd/stdiscosrv/apisrv.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/cmd/stdiscosrv/apisrv.go b/cmd/stdiscosrv/apisrv.go
index 87266870a..c9c8344b3 100644
--- a/cmd/stdiscosrv/apisrv.go
+++ b/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 {