From 0726bae454e7a68ea45ba373f4a4bdac8dbd22b6 Mon Sep 17 00:00:00 2001 From: lian Date: Thu, 28 Apr 2022 18:15:47 +0800 Subject: [PATCH] return 404 when can not get progress --- seahub/api2/endpoints/query_zip_progress.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/seahub/api2/endpoints/query_zip_progress.py b/seahub/api2/endpoints/query_zip_progress.py index 06b7b48f32..0a7205dcad 100644 --- a/seahub/api2/endpoints/query_zip_progress.py +++ b/seahub/api2/endpoints/query_zip_progress.py @@ -13,6 +13,7 @@ from seaserv import seafile_api logger = logging.getLogger(__name__) + class QueryZipProgressView(APIView): throttle_classes = (UserRateThrottle, ) @@ -35,4 +36,8 @@ class QueryZipProgressView(APIView): error_msg = 'Internal Server Error' return api_error(status.HTTP_500_INTERNAL_SERVER_ERROR, error_msg) + if not progress: + error_msg = 'progress not found.' + return api_error(status.HTTP_404_NOT_FOUND, error_msg) + return Response(json.loads(progress))