Skip to content

Commit

Permalink
Verify param in url
Browse files Browse the repository at this point in the history
  • Loading branch information
BryanFauble committed Sep 27, 2024
1 parent 1918ec2 commit dea9244
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions synapseclient/core/download/download_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,10 @@ def _ftp_report_hook(
)

try:
url_has_expiration = "Expires" in urllib_urlparse.urlparse(url).query
url_query = urllib_urlparse.urlparse(url).query
url_has_expiration = (
"Expires" in url_query and "X-Amz-Expires" in url_query
)
url_is_expired = False
if url_has_expiration:
url_is_expired = datetime.datetime.now(
Expand Down Expand Up @@ -773,8 +776,9 @@ def _ftp_report_hook(
exceptions._raise_for_status(response, verbose=client.debug)
except SynapseHTTPError as err:
if err.response.status_code == 403:
url_query = urllib_urlparse.urlparse(url).query
url_has_expiration = (
"Expires" in urllib_urlparse.urlparse(url).query
"Expires" in url_query and "X-Amz-Expires" in url_query
)
url_is_expired = False
if url_has_expiration:
Expand Down

0 comments on commit dea9244

Please sign in to comment.