diff options
author | David Kalnischkies <david@kalnischkies.de> | 2016-12-31 00:07:04 +0100 |
---|---|---|
committer | David Kalnischkies <david@kalnischkies.de> | 2016-12-31 02:29:21 +0100 |
commit | 44ecb8c3579e5ae8828f83530e4151a0ff84d5d6 (patch) | |
tree | f3c6a100a1146ca0fc5866e81c3328449807d083 | |
parent | c8f0f5bd1effdf80c2eee80b3aa4eeb35604a2a1 (diff) | |
download | apt-44ecb8c3579e5ae8828f83530e4151a0ff84d5d6.tar.gz |
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
-rw-r--r-- | apt-pkg/deb/debmetaindex.cc | 7 |
1 files 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<std::string, std::string>::const_iterator const opt = Options.find("by-hash"); if (opt != Options.end()) UseByHash = opt->second; |