diff options
| author | Julian Andres Klode <jak@debian.org> | 2024-11-22 16:12:34 +0000 |
|---|---|---|
| committer | Julian Andres Klode <jak@debian.org> | 2024-11-22 16:12:34 +0000 |
| commit | 1818699c1bc8a5be2d6542fe3212f26af7fa912a (patch) | |
| tree | c6a6312c088d5367d803a884b99246aaff05e9c3 /methods/mirror.cc | |
| parent | f9069c2498f74c09b4a4d7da8bb677756b371dae (diff) | |
| parent | 7adf8c1fa8d519b8b57292763eb7703e7d3cc580 (diff) | |
Merge branch 'fix/partialfilemirror' into 'main'
Support uncompressed indexes from partial file:/ mirrors
See merge request apt-team/apt!235
Diffstat (limited to 'methods/mirror.cc')
| -rw-r--r-- | methods/mirror.cc | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/methods/mirror.cc b/methods/mirror.cc index 787e4c7d5..5781ebcf0 100644 --- a/methods/mirror.cc +++ b/methods/mirror.cc @@ -326,7 +326,11 @@ std::string MirrorMethod::GetMirrorFileURI(std::string const &Message, FetchItem { if (APT::String::Startswith(Itm->Uri, uristr)) { - uristr.erase(uristr.length() - 1); // remove the ending '/' + if (::URI uri{uristr}; uri.Path.length() > 1 && APT::String::Endswith(uri.Path, "/")) + { + uri.Path.erase(uri.Path.length() - 1); // remove the ending '/' + uristr = uri; + } auto const colon = uristr.find(':'); if (unlikely(colon == std::string::npos)) continue; @@ -375,7 +379,10 @@ bool MirrorMethod::URIAcquire(std::string const &Message, FetchItem *Itm) /*{{{* msgCache[Itm->Uri] = Message; MirrorListInfo info; info.state = REQUESTED; - info.baseuri = mirrorfileuri + '/'; + if (not APT::String::Endswith(mirrorfileuri, "/")) + info.baseuri = mirrorfileuri + '/'; + else + info.baseuri = mirrorfileuri; auto const colon = info.baseuri.find(':'); if (unlikely(colon == std::string::npos)) return false; |
