[Web] Change request.base path encoding to utf-8

A user reported a problem with setting base path resulting in this error:

    encoding with 'idna' codec failed (UnicodeError: label too long)

It is likely the base path is longer than 63 chars, which is unusual,
however the idna codec is for domain name not paths so switch to utf-8.

Fixes: #3261
This commit is contained in:
Calum Lind 2019-06-11 12:31:22 +01:00
parent 4dd1f63b8b
commit 5d7db3e727
2 changed files with 2 additions and 1 deletions

View File

@ -6,6 +6,7 @@
- Fix TypeError in Peers Tab setting country flag. - Fix TypeError in Peers Tab setting country flag.
- Fix reverse proxy header TypeError (#3260). - Fix reverse proxy header TypeError (#3260).
- Fix request.base 'idna' codec error (#3261).
### Documentation ### Documentation

View File

@ -583,7 +583,7 @@ class TopLevel(resource.Resource):
if base[-1] != '/': if base[-1] != '/':
base += '/' base += '/'
request.base = base.encode('idna') request.base = base.encode('utf-8')
return resource.Resource.getChildWithDefault(self, path, request) return resource.Resource.getChildWithDefault(self, path, request)