]> git.saurik.com Git - apt.git/commitdiff
avoid producing invalid options if repo has no host
authorDavid Kalnischkies <david@kalnischkies.de>
Fri, 30 Dec 2016 23:07:04 +0000 (00:07 +0100)
committerDavid Kalnischkies <david@kalnischkies.de>
Sat, 31 Dec 2016 01:29:21 +0000 (02:29 +0100)
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

apt-pkg/deb/debmetaindex.cc

index 8d84409a13b767814970d5c069a67c2ebea47e65..cba00aa8eb7510a244e0db2b52795805a35a2cb0 100644 (file)
@@ -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;