From b956d9a58c2f4e92b5871071a861318a669c8428 Mon Sep 17 00:00:00 2001 From: Sajith Sasidharan Date: Fri, 29 May 2020 21:46:23 -0400 Subject: [PATCH] Decode name before null check Make the diff against master a tad bit smaller. --- src/allmydata/web/directory.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/allmydata/web/directory.py b/src/allmydata/web/directory.py index b1618a3f5..a5ba3bed5 100644 --- a/src/allmydata/web/directory.py +++ b/src/allmydata/web/directory.py @@ -104,6 +104,7 @@ class DirectoryNodeHandler(ReplaceMeMixin, Resource, object): # "/uri/URI%3ADIR2%3Aj...vq/" (that is, with a trailing slash # or no further children) renders "this" page. We also need # to reject "/uri/URI:DIR2:..//", so we look at postpath. + name = name.decode('utf8') if not name and req.postpath != ['']: return self @@ -117,7 +118,6 @@ class DirectoryNodeHandler(ReplaceMeMixin, Resource, object): u"The webapi does not allow empty pathname components", ) - name = name.decode('utf8') d = self.node.get(name) d.addBoth(self._got_child, req, name) return d