Escape URLs according to RFC3986.

Previously, we weren't escaping parentheses when generating directory listings.

Pointed out by: Wijatmoko U. Prayitno
This commit is contained in:
Emil Mikulic
2015-05-19 22:02:12 +10:00
parent c4c0034242
commit 1c5fdb5607
2 changed files with 16 additions and 17 deletions

View File

@@ -151,7 +151,7 @@ class TestHelper(unittest.TestCase):
class TestDirList(TestHelper):
def setUp(self):
self.fn = WWWROOT+"/escape#this"
self.fn = WWWROOT+"/escape(this)name"
open(self.fn, "w").write("x"*12345)
def tearDown(self):
@@ -161,7 +161,7 @@ class TestDirList(TestHelper):
resp = self.get("/")
status, hdrs, body = parse(resp)
self.assertEquals(ord("#"), 0x23)
self.assertContains(body, "escape%23this", "12345")
self.assertContains(body, "escape%28this%29name", "12345")
class TestCases(TestHelper):
pass # these get autogenerated in setUpModule()