From fec19de5e786564ed8699b38310f7d1a7c348c01 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sat, 31 Dec 2016 00:07:04 +0100 Subject: 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 (cherry picked from commit 44ecb8c3579e5ae8828f83530e4151a0ff84d5d6) --- apt-pkg/deb/debmetaindex.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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; -- cgit v1.2.3