diff --git a/jenkins/scripts/zuul_swift_upload.py b/jenkins/scripts/zuul_swift_upload.py
index 2f287fb5c2..06e57fb928 100755
--- a/jenkins/scripts/zuul_swift_upload.py
+++ b/jenkins/scripts/zuul_swift_upload.py
@@ -30,6 +30,14 @@ import time
DEBUG = True
+# Map mime types to apache icons
+APACHE_MIME_ICON_MAP = {
+ 'application/gzip': '/icons/compressed.png',
+ 'folder': '/icons/folder.png',
+ 'text/html': '/icons/text.png',
+ 'text/plain': '/icons/text.png',
+ '../': '/icons/back.png',
+}
# file_detail format: A dictionary containing details of the file such as
# full url links or relative path names etc.
@@ -52,16 +60,27 @@ DEBUG = True
# }
+def get_mime_icon(mime, filename=''):
+ if filename == '../':
+ return APACHE_MIME_ICON_MAP[filename]
+ return APACHE_MIME_ICON_MAP[mime]
+
+
def generate_log_index(folder_links, header_message=''):
"""Create an index of logfiles and links to them"""
output = '
Index of results\n'
output += '%s
\n' % header_message
- output += 'Name | Last Modified | Size | '
- output += 'Mime |
\n'
+ output += ' | Name | Last Modified | '
+ output += 'Size | '
for file_details in folder_links:
output += '
---|
'
+ output += '' % ({
+ 'm': file_details['metadata']['mime'],
+ 'i': get_mime_icon(file_details['metadata']['mime'],
+ file_details['filename']),
+ })
output += '%s | ' % (file_details['url'],
file_details['filename'])
output += '%s | ' % time.asctime(
@@ -71,7 +90,6 @@ def generate_log_index(folder_links, header_message=''):
else:
size = sizeof_fmt(file_details['metadata']['size'], suffix='')
output += '%s | ' % size
- output += '%s | ' % file_details['metadata']['mime']
output += '
\n'