Skip to content

Commit

Permalink
add some logs in production
Browse files Browse the repository at this point in the history
  • Loading branch information
Androz2091 committed Mar 15, 2024
1 parent b93ca75 commit 8e1460f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,9 @@ def download_file(package_status_id, package_id, link, session):
if not check_whitelisted_link(link):
print('checking content type')
r = requests.head(link, allow_redirects=True)
# check if location starts with https://storage.googleapis.com after 302
if r.status_code != 302 and not r.headers['Location'].startswith('https://storage.googleapis.com'):
print(r.status_code)
print(r.headers)
if r.status_code != 200 or 'content-type' not in r.headers or 'application/octet-stream' not in r.headers['content-type']:
print('The link does not point to a valid file.')
raise Exception('INVALID_LINK')

Expand Down

0 comments on commit 8e1460f

Please sign in to comment.