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

Commit 160f0bd

Browse files
authored
Add upload-coverage to regex for Auth (#1003)
1 parent 83e45ab commit 160f0bd

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

codecov_auth/authentication/helpers.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +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 = (
17-
r"\/upload\/(\w+)\/([\w\.@:_/\-~]+)\/commits(?:\/([a-f0-9]{40}))?"
18-
)
16+
upload_views_prefix_regex = r"\/upload\/(\w+)\/([\w\.@:_/\-~]+)\/(commits|upload-coverage)(?:\/([a-f0-9]{40}))?"
1917
match = re.search(upload_views_prefix_regex, path_info)
2018

2119
if match is None:
2220
return None
2321

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

2829
return UploadInfo(service, encoded_slug, commitid)

0 commit comments

Comments
 (0)