From: robk-tahoe <robk-tahoe@allmydata.com>
Date: Wed, 11 Jun 2008 19:46:28 +0000 (-0700)
Subject: webish: fix directory url redirection
X-Git-Tag: allmydata-tahoe-1.1.0~11
X-Git-Url: https://git.rkrishnan.org/components/%22news.html/vdrive/global?a=commitdiff_plain;h=021a9e370fb7c3993d7ca06ba748228612a5b45b;p=tahoe-lafs%2Ftahoe-lafs.git

webish: fix directory url redirection

when rendering a directory in webish, if the url did not correctly include
a trailing slash '/' then the browser will be redirected to a url which
does.  this causes any relative links (e.g. the 'other representations'
which are links to files relative to the current directory) to be correctly
intrpreted as relative to the directory in question by the browser.

uses twisted's addSlash mechanism, which is designed for this purpose :-)
---

diff --git a/src/allmydata/web/directory.py b/src/allmydata/web/directory.py
index d9273e07..5fe2db63 100644
--- a/src/allmydata/web/directory.py
+++ b/src/allmydata/web/directory.py
@@ -367,6 +367,7 @@ class DirectoryAsHTML(rend.Page):
     # The remainder of this class is to render the directory into
     # human+browser -oriented HTML.
     docFactory = getxmlfile("directory.xhtml")
+    addSlash = True
 
     def __init__(self, node):
         rend.Page.__init__(self)