From: David Kalnischkies Date: Fri, 30 Dec 2016 23:07:04 +0000 (+0100) Subject: avoid producing invalid options if repo has no host X-Git-Tag: 1.4_beta3~7 X-Git-Url: https://git.saurik.com/apt.git/commitdiff_plain/44ecb8c3579e5ae8828f83530e4151a0ff84d5d6 avoid producing invalid options if repo has no host This can happen e.g. for file: repositories. There is no inherent problem with setting such values internally, but its bad style, forbidden in the manpage and could be annoying in the future. Gbp-Dch: Ignore --- diff --git a/apt-pkg/deb/debmetaindex.cc b/apt-pkg/deb/debmetaindex.cc index 8d84409a1..cba00aa8e 100644 --- a/apt-pkg/deb/debmetaindex.cc +++ b/apt-pkg/deb/debmetaindex.cc @@ -1101,8 +1101,11 @@ class APT_HIDDEN debSLTypeDebian : public pkgSourceList::Type /*{{{*/ UseByHash = _config->Find("Acquire::By-Hash", UseByHash); { std::string const host = ::URI(URI).Host; - UseByHash = _config->Find("APT::Acquire::" + host + "::By-Hash", UseByHash); - UseByHash = _config->Find("Acquire::" + host + "::By-Hash", UseByHash); + if (host.empty() == false) + { + UseByHash = _config->Find("APT::Acquire::" + host + "::By-Hash", UseByHash); + UseByHash = _config->Find("Acquire::" + host + "::By-Hash", UseByHash); + } std::map::const_iterator const opt = Options.find("by-hash"); if (opt != Options.end()) UseByHash = opt->second;