Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try to match if the part after @ is a valid ref (reject treating URL parts as refs). #5856

Merged
merged 2 commits into from
Aug 22, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions pipenv/utils/dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -981,8 +981,9 @@ def install_req_from_pipfile(name, pipfile):
"ssh://" not in vcs_url and "@" in vcs_url
):
vcs_url_parts = vcs_url.rsplit("@", 1)
vcs_url = vcs_url_parts[0]
fallback_ref = vcs_url_parts[1]
if re.match(r"^[\w\.]+$", vcs_url_parts[1]):
vcs_url = vcs_url_parts[0]
fallback_ref = vcs_url_parts[1]
req_str = f"{vcs_url}@{_pipfile.get('ref', fallback_ref)}{extras_str}"
if not req_str.startswith(f"{vcs}+"):
req_str = f"{vcs}+{req_str}"
Expand Down
8 changes: 5 additions & 3 deletions pipenv/utils/requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,11 @@ def requirement_from_lockfile(
"ssh://" not in url and "@" in url
):
url_parts = url.rsplit("@", 1)
url = url_parts[0]
if not ref:
ref = url_parts[1]
# Check if the second part matches the criteria to be a ref (vcs URLs would likely have a /)
if re.match(r"^[\w\.]+$", url_parts[1]):
url = url_parts[0]
if not ref:
ref = url_parts[1]

extras = (
"[{}]".format(",".join(package_info.get("extras", [])))
Expand Down