Skip to content

Commit cd01e55

Browse files
author
Richard Jones
committed
be paranoid about TRACKER_WEB
1 parent ee80ac1 commit cd01e55

File tree

4 files changed

+14
-8
lines changed

4 files changed

+14
-8
lines changed

CHANGES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Fixed:
1717
- export and import now include journals (incompatible with export < 0.7)
1818
- added "download_url" method to generate a correctly quoted URL for file
1919
download links (sf bug 927745)
20+
- all uses of TRACKER_WEB now ensure it ends with a '/'
2021

2122

2223
2004-03-27 0.7.0b2

roundup/cgi/actions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#$Id: actions.py,v 1.22 2004-03-31 23:08:39 richard Exp $
1+
#$Id: actions.py,v 1.23 2004-04-05 06:13:42 richard Exp $
22

33
import re, cgi, StringIO, urllib, Cookie, time, random
44

@@ -77,7 +77,7 @@ def handle(self, typere=re.compile('[@:]type'),
7777
d = {'input': n, 'classname': t}
7878
raise SeriousError, _(
7979
'"%(input)s" is not an ID (%(classname)s ID required)')%d
80-
url = '%s%s%s'%(self.db.config.TRACKER_WEB, t, n)
80+
url = '%s%s%s'%(self.base, t, n)
8181
raise Redirect, url
8282

8383
class RetireAction(Action):

roundup/cgi/client.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $Id: client.py,v 1.169 2004-03-26 05:16:03 richard Exp $
1+
# $Id: client.py,v 1.170 2004-04-05 06:13:42 richard Exp $
22

33
"""WWW request handler (also used in the stand-alone server).
44
"""
@@ -109,6 +109,10 @@ def __init__(self, instance, request, env, form=None):
109109
# this is the base URL for this tracker
110110
self.base = self.instance.config.TRACKER_WEB
111111

112+
# check the tracker_we setting
113+
if not self.base.endswith('/'):
114+
self.base = self.base + '/'
115+
112116
# this is the "cookie path" for this tracker (ie. the path part of
113117
# the "base" url)
114118
self.cookie_path = urlparse.urlparse(self.base)[2]

roundup/roundupdb.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
# $Id: roundupdb.py,v 1.105 2004-03-27 00:12:11 richard Exp $
18+
# $Id: roundupdb.py,v 1.106 2004-04-05 06:13:42 richard Exp $
1919

2020
"""Extending hyperdb with types specific to issue-tracking.
2121
"""
@@ -338,11 +338,12 @@ def email_signature(self, nodeid, msgid):
338338
base = self.db.config.TRACKER_WEB
339339
if (not isinstance(base , type('')) or
340340
not (base.startswith('http://') or base.startswith('https://'))):
341-
base = "Configuration Error: TRACKER_WEB isn't a " \
341+
web = "Configuration Error: TRACKER_WEB isn't a " \
342342
"fully-qualified URL"
343-
elif base[-1] != '/' :
344-
base += '/'
345-
web = base + self.classname + nodeid
343+
else:
344+
if not base.endswith('/'):
345+
base = base + '/'
346+
web = base + self.classname + nodeid
346347

347348
# ensure the email address is properly quoted
348349
email = straddr((self.db.config.TRACKER_NAME,

0 commit comments

Comments
 (0)