Handle symlinks properly in the directory browser.

This change properly handles symlinks by expanding any it finds in the path
and issuing a redirect to the canonical location.

Whilst we're here, display links as such on the pages, sort directory listings
so the parent link is always at the top, and avoid unnecessary redirects caused
by missing /'s on URLs.
This commit is contained in:
Dave Page
2016-11-30 17:48:35 +09:00
parent 71cecf91d2
commit 92dcb0a23d
4 changed files with 42 additions and 8 deletions

View File

@ -41,7 +41,7 @@ def version_sort(l):
"""
map a directory name to a format that will show up sensibly in an ascii sort
"""
mkey = l['url']
mkey = l['link']
m = re.match('v([0-9]+)\.([0-9]+)\.([0-9]+)$',l['url'])
if m:
mkey = m.group(1) + '%02d' % int(m.group(2)) + '%02d' % int(m.group(3));