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

fix: Avoid creating URLs with empty path segments from index URLs in environment variables #2557

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

WillMorrison
Copy link
Contributor

This change updates _read_simpleapi such that it correctly handles the case where the index URL is specified in an environment variable and contains a trailing slash. The URL construction would have introduced an empty path segment, which is now removed.

Fixes: #2554

Copy link
Collaborator

@aignas aignas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor comments only.

download = download,
read = lambda i: "contents of " + i,
path = lambda i: "path/for/" + i,
get_auth = lambda ctx, urls, ctx_attr: struct(),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think adding an extra arg to simpleapi_download would be better. ctx in general does not have get_auth attribute.

@@ -57,6 +57,7 @@ Unreleased changes template.
{#v0-0-0-fixed}
### Fixed
* (gazelle) Providing multiple input requirements files to `gazelle_python_manifest` now works correctly.
* (bazel downloader) Handle trailing slashes in pip index URLs in environment variables
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* (bazel downloader) Handle trailing slashes in pip index URLs in environment variables
* (pypi) Handle trailing slashes in pip index URLs in environment variables,
fixes [#2554](https://github.com/bazelbuild/rules_python/issues/2554).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Trailing slashes not removed from pip index URLs in environment variables before concatenation.
2 participants