Skip to content

Commit d930547

Browse files
committed
Fix 180: PYPI_SIMPLE_INDEX should be at the end not the beginning
Adjust for too long filenames where there's basic auth aka: https://username:password@URL
1 parent c34aaa9 commit d930547

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/python_inspector/api.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,8 @@ def resolve_dependencies(
146146

147147
files = []
148148

149-
if PYPI_SIMPLE_URL not in index_urls:
150-
index_urls = tuple([PYPI_SIMPLE_URL]) + tuple(index_urls)
149+
# if PYPI_SIMPLE_URL not in index_urls:
150+
# index_urls = tuple(index_urls) + tuple([PYPI_SIMPLE_URL])
151151

152152
# requirements
153153
for req_file in requirement_files:

src/python_inspector/utils_pypi.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1593,6 +1593,16 @@ def fetch_links(
15931593
name using the `index_url` of this repository.
15941594
"""
15951595
package_url = f"{self.index_url}/{normalized_name}"
1596+
if len(package_url) >= 256:
1597+
base64_re = re.compile(f"https://(.*:.*)@(.*){normalized_name}")
1598+
match = base64_re.search(self.index_url)
1599+
if match:
1600+
auth = match.group(1)
1601+
username = auth.split(":")[0]
1602+
token = auth,split(":")[1]
1603+
remainder = match.group(2)
1604+
new_index_url = f"https://{username}:{token}@{remainder}"
1605+
package_url = f"{new_index_url}/{normalized_name}"
15961606
text = CACHE.get(
15971607
path_or_url=package_url,
15981608
credentials=self.credentials,

0 commit comments

Comments
 (0)