mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2024-12-20 05:28:04 +00:00
Merge pull request #724 from sajith/3312.webui-directory-fix
Fix for "the webapi does not allow empty pathname components" Fixes: ticket:3312
This commit is contained in:
commit
7a23c8ed6c
1
newsfragments/3312.bugfix
Normal file
1
newsfragments/3312.bugfix
Normal file
@ -0,0 +1 @@
|
||||
Make directory page links work.
|
@ -1269,5 +1269,5 @@ class TrialTestCase(_TrialTestCase):
|
||||
|
||||
if six.PY2:
|
||||
if isinstance(msg, six.text_type):
|
||||
return super(self, TrialTestCase).fail(msg.encode("utf8"))
|
||||
return super(self, TrialTestCase).fail(msg)
|
||||
return super(TrialTestCase, self).fail(msg.encode("utf8"))
|
||||
return super(TrialTestCase, self).fail(msg)
|
||||
|
@ -102,12 +102,21 @@ class DirectoryNodeHandler(ReplaceMeMixin, Resource, object):
|
||||
# trying to replicate what I have observed as Nevow behavior
|
||||
# for these nodes, which is that a URI like
|
||||
# "/uri/URI%3ADIR2%3Aj...vq/" (that is, with a trailing slash
|
||||
# or no further children) renders "this" page
|
||||
# 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:
|
||||
raise EmptyPathnameComponentError(
|
||||
u"The webapi does not allow empty pathname components",
|
||||
)
|
||||
if not name and req.postpath != ['']:
|
||||
return self
|
||||
|
||||
# Rejecting URIs that contain empty path pieces (for example:
|
||||
# "/uri/URI:DIR2:../foo//new.txt" or "/uri/URI:DIR2:..//") was
|
||||
# the old nevow behavior and it is encoded in the test suite;
|
||||
# we will follow suit.
|
||||
for segment in req.prepath:
|
||||
if not segment:
|
||||
raise EmptyPathnameComponentError(
|
||||
u"The webapi does not allow empty pathname components",
|
||||
)
|
||||
|
||||
d = self.node.get(name)
|
||||
d.addBoth(self._got_child, req, name)
|
||||
|
@ -31,7 +31,7 @@
|
||||
<div class="well sidebar-nav">
|
||||
<ul class="nav nav-list">
|
||||
<li class="toolbar-item" t:render="welcome" />
|
||||
<li class="toolbar-item"><a href=".">Refresh</a></li>
|
||||
<li class="toolbar-item"><a href="">Refresh</a></li>
|
||||
<li class="toolbar-item"><a href="?t=info">More info on this directory</a></li>
|
||||
<li class="toolbar-item" t:render="show_readonly" />
|
||||
</ul>
|
||||
|
Loading…
Reference in New Issue
Block a user