From 2b0369a5d1673d9e40f2af4db7677b040a26ee58 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 12 Sep 2021 16:08:52 +0200 Subject: Read and work with canonical file-URIs from sources.lists We allow file (and other file-based methods) URIs to either be given as file:///path or as file:/path, but in various places of the acquire system we perform string comparisons on URIs which do not handle this expecting the canonical representation produced by our URI code. That used to be hidden by us quoting and dequoting the URIs in the system, but as we don't do this anymore we have to be a bit more careful on input. Ideally we would do less of these comparisons, but for now lets be content with inserting a canonicalisation early on to prevent hangs in the acquire system. --- apt-pkg/sourcelist.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/sourcelist.cc b/apt-pkg/sourcelist.cc index cd7dbce9c..0ac59fcfc 100644 --- a/apt-pkg/sourcelist.cc +++ b/apt-pkg/sourcelist.cc @@ -85,12 +85,12 @@ bool pkgSourceList::Type::FixupURI(string &URI) const if (URI.find(':') == string::npos) return false; - URI = SubstVar(URI,"$(ARCH)",_config->Find("APT::Architecture")); - + URI = ::URI{SubstVar(URI, "$(ARCH)", _config->Find("APT::Architecture"))}; + // Make sure that the URI is / postfixed - if (URI[URI.size() - 1] != '/') - URI += '/'; - + if (URI.back() != '/') + URI.push_back('/'); + return true; } /*}}}*/ -- cgit v1.2.3-70-g09d2