mirror of
https://github.com/haiwen/seahub.git
synced 2025-08-02 07:47:32 +00:00
Fix bug in repo_file_get
This commit is contained in:
parent
aca8a7309f
commit
a99ed91e49
3
views.py
3
views.py
@ -853,12 +853,15 @@ def repo_file_get(raw_path):
|
||||
file_response = urllib2.urlopen(raw_path)
|
||||
if long(file_response.headers['Content-Length']) > FILE_PREVIEW_MAX_SIZE:
|
||||
err = '文件超过10M,无法在线查看。'
|
||||
return err, '', ''
|
||||
else:
|
||||
content = file_response.read()
|
||||
except urllib2.HTTPError, e:
|
||||
err = 'HTTPError: 无法在线打开该文件'
|
||||
return err, '', ''
|
||||
except urllib2.URLError as e:
|
||||
err = 'URLError: 无法在线打开该文件'
|
||||
return err, '', ''
|
||||
else:
|
||||
try:
|
||||
u_content = content.decode('utf-8')
|
||||
|
Loading…
Reference in New Issue
Block a user