summaryrefslogtreecommitdiff
path: root/apt-pkg/deb
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2016-12-31 00:07:04 +0100
committerJulian Andres Klode <jak@debian.org>2017-02-22 16:53:45 +0100
commitfec19de5e786564ed8699b38310f7d1a7c348c01 (patch)
tree26519b9effd5be712c99b74f31a0b9867a26354a /apt-pkg/deb
parent24217e734c2ce603e0ff8bfa083535905955eff1 (diff)
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)
Diffstat (limited to 'apt-pkg/deb')
-rw-r--r--apt-pkg/deb/debmetaindex.cc7
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;