Skip to content

Commit 5773d65

Browse files
XciDWauplin
authored andcommitted
Remove Authorization header when following redirects (#1345)
1 parent e8f0676 commit 5773d65

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/huggingface_hub/file_download.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -675,6 +675,7 @@ def cached_download(
675675
# Useful for lfs blobs that are stored on a CDN.
676676
if 300 <= r.status_code <= 399:
677677
url_to_download = r.headers["Location"]
678+
headers.pop("authorization", None)
678679
except (requests.exceptions.SSLError, requests.exceptions.ProxyError):
679680
# Actually raise for those subclasses of ConnectionError
680681
raise

0 commit comments

Comments
 (0)