From a99ed91e49f39990e3da23fe01247ec0c9dc73ba Mon Sep 17 00:00:00 2001 From: xiez Date: Fri, 10 Aug 2012 10:43:51 +0800 Subject: [PATCH] Fix bug in repo_file_get --- views.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/views.py b/views.py index 30513ffee9..1c7753b314 100644 --- a/views.py +++ b/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')