Add trailing slash if missing to find-links URL

This commit is contained in:
John Mumm 2025-06-30 13:15:50 +02:00
parent b2979d25a8
commit 6cd9023dff
No known key found for this signature in database
GPG key ID: 73D2271AFDC26EA8

View file

@ -162,6 +162,14 @@ impl<'a> FlatIndexClient<'a> {
url: &DisplaySafeUrl,
flat_index: &IndexUrl,
) -> Result<FlatIndexEntries, Error> {
let mut url = url.clone();
url.path_segments_mut()
.map_err(|()| ErrorKind::CannotBeABase(flat_index.url().clone()))?
.pop_if_empty()
// Add a trailing slash to avoid redirect, which is not supported
// by some private registries.
.push("");
let cache_entry = self.cache.entry(
CacheBucket::FlatIndex,
"html",
@ -179,7 +187,7 @@ impl<'a> FlatIndexClient<'a> {
let flat_index_request = self
.client
.uncached()
.for_host(url)
.for_host(&url)
.get(Url::from(url.clone()))
.header("Accept-Encoding", "gzip")
.header("Accept", "text/html")