summaryrefslogtreecommitdiff
path: root/paste/urlparser.py
diff options
context:
space:
mode:
authorianb <devnull@localhost>2005-12-13 22:30:42 +0000
committerianb <devnull@localhost>2005-12-13 22:30:42 +0000
commit431acd0a6e9d98d370eb49ff83deb2d795290c31 (patch)
tree0fd78d27a72a25eb4a5ede056ffd752e19c24cec /paste/urlparser.py
parent79a180fe42ec19c008ea371c1f5b0f1d1a6c1500 (diff)
downloadpaste-431acd0a6e9d98d370eb49ff83deb2d795290c31.tar.gz
Be a little less picky about 'ambiguous' filenames in URLParser, when one of the filename matches is an exact match
Diffstat (limited to 'paste/urlparser.py')
-rw-r--r--paste/urlparser.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/paste/urlparser.py b/paste/urlparser.py
index 0e6efac..47e89aa 100644
--- a/paste/urlparser.py
+++ b/paste/urlparser.py
@@ -239,10 +239,16 @@ class URLParser(object):
# % (base_filename, self.directory))
return None
if len(possible) > 1:
- environ['wsgi.errors'].write(
- 'Ambiguous URL: %s; matches files %s\n'
- % (wsgilib.construct_url(environ),
- ', '.join(possible)))
+ # If there is an exact match, this isn't 'ambiguous'
+ # per se; it might mean foo.gif and foo.gif.back for
+ # instance
+ if full_filename in possible:
+ return full_filename
+ else:
+ environ['wsgi.errors'].write(
+ 'Ambiguous URL: %s; matches files %s\n'
+ % (wsgilib.construct_url(environ),
+ ', '.join(possible)))
return None
return possible[0]