1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-25 14:50:29 +00:00

Fix a bug for empty file

This commit is contained in:
poetwang
2013-08-22 23:20:42 +08:00
parent e1edf52c8f
commit 438fb8aa0a

View File

@@ -589,10 +589,10 @@ def get_repo_file(request, repo_id, file_id, file_name, op):
if file_id != EMPTY_SHA1: if file_id != EMPTY_SHA1:
try: try:
blks = seafile_api.list_file_by_file_id(file_id) blks = seafile_api.list_file_by_file_id(file_id)
blklist = blks.split('\n')
except SearpcError, e: except SearpcError, e:
return api_error(status.HTTP_520_OPERATION_FAILED, return api_error(status.HTTP_520_OPERATION_FAILED,
'Failed to get file block list') 'Failed to get file block list')
blklist = blks.split('\n')
blklist = [i for i in blklist if len(i) == 40] blklist = [i for i in blklist if len(i) == 40]
if len(blklist) > 0: if len(blklist) > 0:
repo = get_repo(repo_id) repo = get_repo(repo_id)