1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-25 06:33:48 +00:00

still remove repo when data is damaged in seafile-date (#4105)

This commit is contained in:
Leo
2019-09-23 14:24:47 +08:00
committed by Daniel Pan
parent 83c091b8cf
commit 72fae2d110

View File

@@ -351,8 +351,17 @@ class RepoView(APIView):
repo = seafile_api.get_repo(repo_id)
if not repo:
error_msg = 'Library %s not found.' % repo_id
return api_error(status.HTTP_404_NOT_FOUND, error_msg)
# for case of `seafile-data` has been damaged
# no `repo object` will be returned from seafile api
# delete the database record anyway
try:
seafile_api.remove_repo(repo_id)
except Exception as e:
logger.error(e)
error_msg = 'Internal Server Error'
return api_error(status.HTTP_500_INTERNAL_SERVER_ERROR, error_msg)
return Response({'success': True})
# check permission
username = request.user.username