detech empty pathname components, hopefully the same way as Nevow
This commit is contained in:
parent
83a70bb6f3
commit
bc04c9b3db
|
@ -1737,7 +1737,7 @@ class Web(WebMixin, WebErrorMixin, testutil.StallMixin, testutil.ReallyEqualMixi
|
||||||
return d
|
return d
|
||||||
|
|
||||||
# XXX this 'fails' (as it should), but not with '409 Conflict' ...
|
# XXX this 'fails' (as it should), but not with '409 Conflict' ...
|
||||||
def _test_PUT_NEWFILEURL_blocked(self):
|
def test_PUT_NEWFILEURL_blocked(self):
|
||||||
d = self.PUT(self.public_url + "/foo/blockingfile/new.txt",
|
d = self.PUT(self.public_url + "/foo/blockingfile/new.txt",
|
||||||
self.NEWFILE_CONTENTS)
|
self.NEWFILE_CONTENTS)
|
||||||
d.addBoth(self.shouldFail, error.Error, "PUT_NEWFILEURL_blocked",
|
d.addBoth(self.shouldFail, error.Error, "PUT_NEWFILEURL_blocked",
|
||||||
|
|
|
@ -112,6 +112,14 @@ class DirectoryNodeHandler(ReplaceMeMixin, Resource, object):
|
||||||
# or no further children) renders "this" page
|
# or no further children) renders "this" page
|
||||||
name = name.decode('utf8')
|
name = name.decode('utf8')
|
||||||
if not name:
|
if not name:
|
||||||
|
# replicating Nevow behavior that complains about "empty
|
||||||
|
# path segments" .. but twisted.web sends in "name=None"
|
||||||
|
# for a URL like "/foo/bar/" as well as "/foo//bar"
|
||||||
|
# (i.e. a trailing slash means "name=None" as well)
|
||||||
|
if b'//' in req.path:
|
||||||
|
raise EmptyPathnameComponentError(
|
||||||
|
u"The webapi does not allow empty pathname components, i.e. a double slash",
|
||||||
|
)
|
||||||
return self
|
return self
|
||||||
d = self.node.get(name)
|
d = self.node.get(name)
|
||||||
d.addBoth(self._got_child, req, name)
|
d.addBoth(self._got_child, req, name)
|
||||||
|
|
Loading…
Reference in New Issue