Skip to content

Commit

Permalink
adjust patcher
Browse files Browse the repository at this point in the history
  • Loading branch information
mcg1969 committed Nov 21, 2024
1 parent 0727468 commit 2628a19
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions anaconda_anon_usage/patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@ def _new_user_agent(ctx):
def _new_apply_basic_auth(request):
assert CondaHttpAuth is not None
result = CondaHttpAuth._old_apply_basic_auth(request)
auth_token = auth_string(request.url, context.anaconda_anon_usage)
if auth_token and "X-Auth" not in request.headers:
request.headers["X-Auth"] = auth_token
if "X-Auth" not in request.headers:
auth_token = auth_string(request.url, context.anaconda_anon_usage)
if auth_token:
request.headers["X-Auth"] = auth_token
return result


Expand Down
2 changes: 1 addition & 1 deletion anaconda_anon_usage/tokens.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def auth_string(url, enabled=True):
if debug_token:
all_tokens = {
"https://anaconda.cloud/": debug_token,
"https://conda.anaconda.org/": debug_token + -"wrong",
"https://conda.anaconda.org/": debug_token + "-wrong",
}
for t_url, t_val in all_tokens.items():
match = re.match(
Expand Down

0 comments on commit 2628a19

Please sign in to comment.