diff --git a/templates/repo_file_get.html b/templates/repo_file_get.html index fccfa0c915..bbb72c3d57 100644 --- a/templates/repo_file_get.html +++ b/templates/repo_file_get.html @@ -150,6 +150,6 @@ }); }); {% endif %} -{% if filetype != 'Text' and filetype != 'Image' and filetype != 'SVG' and filetype != 'Document' and filetype != 'PDF' %} +{% if filetype == 'Unkown' %} $('#file-view').html('

该类型文件无法在线查看。下载

'); {% endif %} diff --git a/templates/view_shared_file.html b/templates/view_shared_file.html index 30e9c66ebb..33c6d43345 100644 --- a/templates/view_shared_file.html +++ b/templates/view_shared_file.html @@ -20,8 +20,7 @@ {% block extra_script %} {% endblock %} diff --git a/utils.py b/utils.py index c51b57c056..9d3b6e6cf2 100644 --- a/utils.py +++ b/utils.py @@ -240,7 +240,7 @@ def valid_previewed_file(filename): """ fileExt = os.path.splitext(filename)[1][1:] - return FILEEXT_TYPE_MAP.get(fileExt) + return FILEEXT_TYPE_MAP.get(fileExt) or 'Unkown' def get_file_revision_id_size (commit_id, path): """Given a commit and a file path in that commit, return the seafile id