Revision: 3936 Author: wikipedian Date: 2007-08-01 21:37:41 +0000 (Wed, 01 Aug 2007)
Log Message: ----------- some servers redirect to .. although we are already in the root directory; ignore this.
Modified Paths: -------------- trunk/pywikipedia/weblinkchecker.py
Modified: trunk/pywikipedia/weblinkchecker.py =================================================================== --- trunk/pywikipedia/weblinkchecker.py 2007-08-01 21:19:26 UTC (rev 3935) +++ trunk/pywikipedia/weblinkchecker.py 2007-08-01 21:37:41 UTC (rev 3936) @@ -270,9 +270,12 @@ # handle redirect to parent directory while redirTarget.startswith('../'): redirTarget = redirTarget[3:] - # change /foo/bar/ to /foo/ - directory = directory[:-1] - directory = directory[:directory.rindex('/') + 1] + # some servers redirect to .. although we are already + # in the root directory; ignore this. + if directory != '/': + # change /foo/bar/ to /foo/ + directory = directory[:-1] + directory = directory[:directory.rindex('/') + 1] self.changeUrl('%s://%s%s%s' % (self.protocol, self.host, directory, redirTarget)) return True else:
pywikipedia-l@lists.wikimedia.org