Skip to content

Commit

Permalink
Log internet not available as warning and show in HTTP response
Browse files Browse the repository at this point in the history
  • Loading branch information
ayushmanchhabra committed Sep 7, 2024
1 parent 43860d5 commit 91eeaf8
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions mobsf/MobSF/views/home.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,14 +320,19 @@ def recent_scans(request, page_size=10, page_number=1):
@permission_required(Permissions.SCAN)
def download_apk(request):
"""Download an APK by package name."""
if not is_internet_available():
return logger.warning(request, 'Internet Not Available. Unable to download APK')
package = request.POST['package']
# Package validated in apk_download()
context = {
'status': 'failed',
'description': 'Unable to download APK',
}
if not is_internet_available():
context['description'] = 'Internet Not Available. Unable to download APK'
logger.warning(context['description'])
resp = HttpResponse(
json.dumps(context),
content_type='application/json; charset=utf-8')
return resp
res = apk_download(package)
if res:
context = res
Expand Down

0 comments on commit 91eeaf8

Please sign in to comment.