summaryrefslogtreecommitdiff
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 18:11:44 +0100
commite81fd8d19c433b5b96f91d9e905ed2f1e5d96ce6 (patch)
treea2020903c0c8b907e991ffc3656ff8745b51f1b6
parente3a961869a89016a1e197312002b96325ecc5534 (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) (cherry picked from commit fec19de5e786564ed8699b38310f7d1a7c348c01)
-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 71b208622..8b4430c9d 100644
--- a/apt-pkg/deb/debmetaindex.cc
+++ b/apt-pkg/deb/debmetaindex.cc
@@ -921,8 +921,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;