Skip to content

Commit 679e9d4

Browse files
committed
chore(pypi): add comment to clarify handling of trailing slash in URLs
Signed-off-by: Amine <[email protected]>
1 parent 7e41b96 commit 679e9d4

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/macaron/slsa_analyzer/package_registry/pypi_registry.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,10 +244,12 @@ def get_package_page(self, package_name: str) -> str | None:
244244
str | None
245245
The package main page.
246246
"""
247-
url = f"https://pypi.org/project/{package_name}/"
247+
# Important: trailing '/' avoids JS-based redirect; ensures Macaron can access the page directly
248+
url = urllib.parse.urljoin(self.registry_url, f"project/{package_name}/")
248249
response = send_get_http_raw(url)
249250
if response:
250-
return response.text
251+
html_snippets = response.content.decode("utf-8")
252+
return html_snippets
251253
return None
252254

253255
def get_maintainers_of_package(self, package_name: str) -> list | None:

0 commit comments

Comments
 (0)