From 4af2212c9ef8b1af70bfc23bae8f46e93b22a9d4 Mon Sep 17 00:00:00 2001 From: xiaoyu Date: Fri, 24 Jul 2020 18:32:16 +0800 Subject: [PATCH] fix a bug --- fir_ser/api/views/download.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/fir_ser/api/views/download.py b/fir_ser/api/views/download.py index 5ea0dfb..e7e486a 100644 --- a/fir_ser/api/views/download.py +++ b/fir_ser/api/views/download.py @@ -82,16 +82,24 @@ class DownloadView(APIView): appsuper_obj = APPSuperSignUsedInfo.objects.filter(app_id=release_obj.app_id).last() if not appsuper_obj: appsuper_obj = APPSuperSignUsedInfo.objects.last() - developer_obj = appsuper_obj.developerid - file_path = get_profile_full_path(developer_obj, release_obj.app_id) - if os.path.isfile(file_path): - response = FileResponse(open(file_path, 'rb')) - else: + + if not appsuper_obj: file_path = settings.DEFAULT_MOBILEPROVISION.get("supersign").get('path') if os.path.isfile(file_path): response = FileResponse(open(file_path, 'rb')) else: response = FileResponse() + else: + developer_obj = appsuper_obj.developerid + file_path = get_profile_full_path(developer_obj, release_obj.app_id) + if os.path.isfile(file_path): + response = FileResponse(open(file_path, 'rb')) + else: + file_path = settings.DEFAULT_MOBILEPROVISION.get("supersign").get('path') + if os.path.isfile(file_path): + response = FileResponse(open(file_path, 'rb')) + else: + response = FileResponse() response['Content-Type'] = "application/x-apple-aspen-config" response['Content-Disposition'] = 'attachment; filename=' + make_random_uuid() + '.mobileprovision' return response