@@ -2351,9 +2351,14 @@ def _url_handler(url, content_type="text/html"):
'key = %s' % key, '#ffffff', '#ee77aa', '
'.join(results))
return 'Search Results', contents
- def html_getfile(path):
+ def html_getfile(url):
"""Get and display a source file listing safely."""
- path = path.replace('%20', ' ')
+ url = url.replace('%20', ' ')
+ if sys.platform == 'win32':
+ import nturl2path
+ path = nturl2path.url2pathname(url)
+ else:
+ path = url
with tokenize.open(path) as fp:
lines = html.escape(fp.read())
body = '
%s' % lines