Skip to content
This repository was archived by the owner on Jun 13, 2025. It is now read-only.

Commit 59d7756

Browse files
committed
Use different matching to retain commitid
1 parent 303c24f commit 59d7756

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

codecov_auth/authentication/helpers.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,17 @@ class UploadInfo(NamedTuple):
1313
def get_upload_info_from_request_path(request: HttpRequest) -> UploadInfo | None:
1414
path_info = request.get_full_path_info()
1515
# The repo part comes from https://stackoverflow.com/a/22312124
16-
upload_views_prefix_regex = r"\/upload\/(\w+)\/([\w\.@:_/\-~]+)\/(commits(?:\/([a-f0-9]{40}))?|upload-coverage)"
16+
upload_views_prefix_regex = r"\/upload\/(\w+)\/([\w\.@:_/\-~]+)\/(commits|upload-coverage)(?:\/([a-f0-9]{40}))?"
1717
match = re.search(upload_views_prefix_regex, path_info)
1818

1919
if match is None:
2020
return None
2121

2222
service = match.group(1)
2323
encoded_slug = match.group(2)
24-
commitid = match.group(3)
24+
if match.group(3) == "commits":
25+
commitid = match.group(4)
26+
else:
27+
commitid = None
2528

2629
return UploadInfo(service, encoded_slug, commitid)

0 commit comments

Comments
 (0)