]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
web/unlinked.py: don't use % operator to expand %(uri)s. fixes #1860.
authorDavid-Sarah Hopwood <david-sarah@jacaranda.org>
Thu, 15 Nov 2012 04:16:19 +0000 (04:16 +0000)
committerDavid-Sarah Hopwood <david-sarah@jacaranda.org>
Thu, 15 Nov 2012 04:16:19 +0000 (04:16 +0000)
Signed-off-by: David-Sarah Hopwood <david-sarah@jacaranda.org>
src/allmydata/test/test_web.py
src/allmydata/web/unlinked.py

index d52ce676a8b9b3690aae0baea6f569b76e82f2b3..146fdf2cb39fd57cd2040e82df9b0aee3d115d16 100644 (file)
@@ -2117,10 +2117,11 @@ class Web(WebMixin, WebErrorMixin, testutil.StallMixin, testutil.ReallyEqualMixi
             self.failUnlessReallyEqual(statuscode, str(http.FOUND))
             self.failUnless(target.startswith(self.webish_url), target)
             return client.getPage(target, method="GET")
+        # We encode "uri" as "%75ri" to exercise a case affected by ticket #1860.
         d = self.shouldRedirect2("test_POST_upload_no_link_whendone_results",
                                  check,
                                  self.POST, "/uri", t="upload",
-                                 when_done="/uri/%(uri)s",
+                                 when_done="/%75ri/%(uri)s",
                                  file=("new.txt", self.NEWFILE_CONTENTS))
         d.addCallback(lambda res:
                       self.failUnlessReallyEqual(res, self.NEWFILE_CONTENTS))
index 64ebec7b7aa2deb257ed064ed8e668644a8494d7..8a84a4021db039aabd34be248eadd99c3baa75b8 100644 (file)
@@ -50,8 +50,7 @@ def POSTUnlinkedCHK(req, client):
         # usual upload-results page
         def _done(upload_results, redir_to):
             if "%(uri)s" in redir_to:
-                redir_to = redir_to % {"uri": urllib.quote(upload_results.get_uri())
-                                         }
+                redir_to = redir_to.replace("%(uri)s", urllib.quote(upload_results.get_uri()))
             return url.URL.fromString(redir_to)
         d.addCallback(_done, when_done)
     else: