Skip to content

Comments

Fix missing remote lockfile invalidation when URL has no path#14348

Closed
zanieb wants to merge 1 commit intomainfrom
zb/lock-check-slash
Closed

Fix missing remote lockfile invalidation when URL has no path#14348
zanieb wants to merge 1 commit intomainfrom
zb/lock-check-slash

Conversation

@zanieb
Copy link
Member

@zanieb zanieb commented Jun 29, 2025

Fixes #14344 (comment)

Url::pop_if_empty, used at

// Remove trailing slashes for consistency. They'll be re-added if necessary when
// querying the Simple API.
if let Ok(mut path_segments) = url.raw_mut().path_segments_mut() {
path_segments.pop_if_empty();
}

does not remove a / if there's no path, e.g., https://example.com/ (vs https://example.com/foo/)

However, UrlString::without_trailing_slash always trims the trailing slash

pub fn without_trailing_slash(&self) -> Cow<'_, Self> {
self.as_ref()
.strip_suffix('/')

since these are inconsistent, we consider URLs inequal and uv lock --check regresses with

Ignoring existing lockfile due to missing remote index: anyio 4.9.0 from https://localhost:8999

@zanieb zanieb added the bug Something isn't working label Jun 29, 2025
Copy link
Member

@charliermarsh charliermarsh left a comment

Choose a reason for hiding this comment

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

I think we should fix without_trailing_slash to match pop_if_empty, but this is also fine for now.

@zanieb
Copy link
Member Author

zanieb commented Jun 29, 2025

Preferring #14349

@zanieb zanieb closed this Jun 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Version 0.7.16 invalidates lock files from <=0.7.15 due to an added trailing slash

2 participants