Opened 11 years ago

Last modified 11 years ago

#290 defect closed fixed (fixed)

twisted.web.server.Request.childLink is buggy on requests where URL ends with a slash.

Reported by: Tv Owned by:
Priority: high Milestone:
Component: Keywords:
Cc: Tv Branch:
Author: Launchpad Bug:

Description


Change History (3)

comment:1 Changed 11 years ago by Tv

I have a web resource that has isLeaf=1. URL is
http://localhost/myresource/. myresource does
request.childLink('foo'). Because request.prepath ==
['myresource', ''], childLink returns
self.prepath[-1]+'/'+name, which is ''+'/'+name = '/'+name =
'/foo', which isn't myresource's child at all.

This patch makes the problem go away, but might have bad
side effects.

diff -u -u -r1.102 server.py
--- server.py   12 Sep 2003 10:30:11 -0000      1.102
+++ server.py   27 Sep 2003 18:29:11 -0000
@@ -136,7 +136,7 @@
             return name
         else: # lpp == 0
             if len(self.prepath):
-                return self.prepath[-1] + '/' + name
+                return (self.prepath[-1] or '.') + '/' + name
             else:
                 return name

comment:2 Changed 11 years ago by itamarst

Apparently moshez fixed this.

comment:3 Changed 4 years ago by <automation>

Note: See TracTickets for help on using tickets.