Try not to crash the ftp browser when there is a directory named README
authorMagnus Hagander <magnus@hagander.net>
Mon, 29 Oct 2012 20:53:05 +0000 (21:53 +0100)
committerMagnus Hagander <magnus@hagander.net>
Mon, 29 Oct 2012 20:53:05 +0000 (21:53 +0100)
pgweb/downloads/views.py

index 730ae66fb4b4580becd6857eaead9d4b5cbf10b1..6cdae8a33c6ce34f491ff9fc010bc5c2d616a526 100644 (file)
@@ -74,9 +74,9 @@ def ftpbrowser(request, subpath):
                        breadcrumbs.append({'name': pathpiece, 'path': breadroot});
 
        # Check if there are any "content files" we should render directly on the webpage
-       file_readme = node.has_key('README') and node['README']['c'] or None;
-       file_message = node.has_key('.message') and node['.message']['c'] or None;
-       file_maintainer = node.has_key('CURRENT_MAINTAINER') and node['CURRENT_MAINTAINER']['c'] or None;
+       file_readme = (node.has_key('README') and node['README']['t']=='f') and node['README']['c'] or None;
+       file_message = (node.has_key('.message') and node['.message']['t']=='f') and node['.message']['c'] or None;
+       file_maintainer = (node.has_key('CURRENT_MAINTAINER') and node['CURRENT_MAINTAINER']['t'] == 'f') and node['CURRENT_MAINTAINER']['c'] or None;
 
        del node