Make sure there is a default icon for swift index
Check an icon exists for the file mimetype or otherwise use a default icon on the swift log indexes. Change-Id: Id8ae918c5888b19c2702a711a292ca8f0176cbdd
This commit is contained in:
parent
982cea8730
commit
6a95d63dd5
@ -32,6 +32,7 @@ DEBUG = True
|
|||||||
|
|
||||||
# Map mime types to apache icons
|
# Map mime types to apache icons
|
||||||
APACHE_MIME_ICON_MAP = {
|
APACHE_MIME_ICON_MAP = {
|
||||||
|
'_default': '/icons/unknown.png',
|
||||||
'application/gzip': '/icons/compressed.png',
|
'application/gzip': '/icons/compressed.png',
|
||||||
'folder': '/icons/folder.png',
|
'folder': '/icons/folder.png',
|
||||||
'text/html': '/icons/text.png',
|
'text/html': '/icons/text.png',
|
||||||
@ -61,9 +62,11 @@ APACHE_MIME_ICON_MAP = {
|
|||||||
|
|
||||||
|
|
||||||
def get_mime_icon(mime, filename=''):
|
def get_mime_icon(mime, filename=''):
|
||||||
if filename == '../':
|
if filename == '../' and filename in APACHE_MIME_ICON_MAP:
|
||||||
return APACHE_MIME_ICON_MAP[filename]
|
return APACHE_MIME_ICON_MAP[filename]
|
||||||
|
if mime in APACHE_MIME_ICON_MAP:
|
||||||
return APACHE_MIME_ICON_MAP[mime]
|
return APACHE_MIME_ICON_MAP[mime]
|
||||||
|
return APACHE_MIME_ICON_MAP['_default']
|
||||||
|
|
||||||
|
|
||||||
def generate_log_index(folder_links, header_message=''):
|
def generate_log_index(folder_links, header_message=''):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user