From ea459529036780fd6f5bac68d989391982c60799 Mon Sep 17 00:00:00 2001 From: richard Date: Mon, 5 Apr 2004 06:13:42 +0000 Subject: [PATCH] be paranoid about TRACKER_WEB git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@2254 57a73879-2fb5-44c3-a270-3262357dd7e2 --- CHANGES.txt | 1 + roundup/cgi/actions.py | 4 ++-- roundup/cgi/client.py | 6 +++++- roundup/roundupdb.py | 11 ++++++----- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 58975a4..26ee060 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -17,6 +17,7 @@ Fixed: - export and import now include journals (incompatible with export < 0.7) - added "download_url" method to generate a correctly quoted URL for file download links (sf bug 927745) +- all uses of TRACKER_WEB now ensure it ends with a '/' 2004-03-27 0.7.0b2 diff --git a/roundup/cgi/actions.py b/roundup/cgi/actions.py index df368eb..e8f91d7 100755 --- a/roundup/cgi/actions.py +++ b/roundup/cgi/actions.py @@ -1,4 +1,4 @@ -#$Id: actions.py,v 1.22 2004-03-31 23:08:39 richard Exp $ +#$Id: actions.py,v 1.23 2004-04-05 06:13:42 richard Exp $ import re, cgi, StringIO, urllib, Cookie, time, random @@ -77,7 +77,7 @@ class ShowAction(Action): d = {'input': n, 'classname': t} raise SeriousError, _( '"%(input)s" is not an ID (%(classname)s ID required)')%d - url = '%s%s%s'%(self.db.config.TRACKER_WEB, t, n) + url = '%s%s%s'%(self.base, t, n) raise Redirect, url class RetireAction(Action): diff --git a/roundup/cgi/client.py b/roundup/cgi/client.py index c34d426..b68d3af 100644 --- a/roundup/cgi/client.py +++ b/roundup/cgi/client.py @@ -1,4 +1,4 @@ -# $Id: client.py,v 1.169 2004-03-26 05:16:03 richard Exp $ +# $Id: client.py,v 1.170 2004-04-05 06:13:42 richard Exp $ """WWW request handler (also used in the stand-alone server). """ @@ -109,6 +109,10 @@ class Client: # this is the base URL for this tracker self.base = self.instance.config.TRACKER_WEB + # check the tracker_we setting + if not self.base.endswith('/'): + self.base = self.base + '/' + # this is the "cookie path" for this tracker (ie. the path part of # the "base" url) self.cookie_path = urlparse.urlparse(self.base)[2] diff --git a/roundup/roundupdb.py b/roundup/roundupdb.py index 35ff923..d59d41e 100644 --- a/roundup/roundupdb.py +++ b/roundup/roundupdb.py @@ -15,7 +15,7 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -# $Id: roundupdb.py,v 1.105 2004-03-27 00:12:11 richard Exp $ +# $Id: roundupdb.py,v 1.106 2004-04-05 06:13:42 richard Exp $ """Extending hyperdb with types specific to issue-tracking. """ @@ -338,11 +338,12 @@ class IssueClass: base = self.db.config.TRACKER_WEB if (not isinstance(base , type('')) or not (base.startswith('http://') or base.startswith('https://'))): - base = "Configuration Error: TRACKER_WEB isn't a " \ + web = "Configuration Error: TRACKER_WEB isn't a " \ "fully-qualified URL" - elif base[-1] != '/' : - base += '/' - web = base + self.classname + nodeid + else: + if not base.endswith('/'): + base = base + '/' + web = base + self.classname + nodeid # ensure the email address is properly quoted email = straddr((self.db.config.TRACKER_NAME, -- 2.30.2