1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-04 00:20:07 +00:00

Set unkown file type

This commit is contained in:
plt
2012-07-26 15:43:42 +08:00
parent afb931a333
commit 3d1f2ba50c
3 changed files with 3 additions and 4 deletions

View File

@@ -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('<p>该类型文件无法在线查看。<a href="{{ SITE_ROOT }}repo/{{ repo.id }}/{{ obj_id }}/?file_name={{ file_name }}&op=download">下载</a></p>');
{% endif %}

View File

@@ -20,7 +20,6 @@
{% block extra_script %}
<script type="text/javascript">
var url = '{{ SITE_ROOT }}repo/{{ repo.id }}/file/get/?t={{ access_token }}&p={{ path|urlencode }}&u={{ username }}',
filetype = '{{ filetype }}';
{% include "repo_file_get.html" %}
</script>

View File

@@ -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