Skip to content

Commit

Permalink
Not passing headers when redirected
Browse files Browse the repository at this point in the history
GitHub is using Azure blob storage which does not expect an authorization header. Need to make sure this header is not being passed on the redirect or the download will fail.
  • Loading branch information
colincornaby authored and Hoikas committed Jul 16, 2024
1 parent 386a287 commit a1c064f
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions urumanifest/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,8 @@ def query_result() -> str:

def download_file(self, url: str, hook: Callable[[int, int, int], None] = None, delete: bool = True) -> tempfile.NamedTemporaryFile:
logging.trace(f"Downloading {url}")
headers = dict()
if self._token is not None:
headers["Authorization"] = f"token {self._token}"
req = urllib.request.Request(url, headers=headers)
req = urllib.request.Request(url)
req.add_unredirected_header("Authorization", f"token {self._token}")
with closing(urllib.request.urlopen(req)) as res:
fp = tempfile.NamedTemporaryFile("w+b", delete=delete)
size, block = 0, 1024 * 8
Expand Down

0 comments on commit a1c064f

Please sign in to comment.