diff options
Diffstat (limited to 'qutebrowser/browser/downloads.py')
-rw-r--r-- | qutebrowser/browser/downloads.py | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/qutebrowser/browser/downloads.py b/qutebrowser/browser/downloads.py index e7e53c33a..28f20b0ef 100644 --- a/qutebrowser/browser/downloads.py +++ b/qutebrowser/browser/downloads.py @@ -1,19 +1,6 @@ -# Copyright 2014-2021 Florian Bruhin (The Compiler) <mail@qutebrowser.org> +# SPDX-FileCopyrightText: Florian Bruhin (The Compiler) <mail@qutebrowser.org> # -# This file is part of qutebrowser. -# -# qutebrowser is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# qutebrowser is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with qutebrowser. If not, see <https://www.gnu.org/licenses/>. +# SPDX-License-Identifier: GPL-3.0-or-later """Shared QtWebKit/QtWebEngine code for downloads.""" @@ -830,8 +817,13 @@ class AbstractDownloadItem(QObject): - file:// downloads from file:// URLs (open the file instead) - http:// downloads from https:// URLs (mixed content) """ - origin = self.origin() url = self.url() + if url.scheme() not in ["file", "http"]: + # WORKAROUND to avoid calling self.origin() if unneeded: + # https://github.com/qutebrowser/qutebrowser/issues/7854 + return False + + origin = self.origin() if not origin.isValid(): return False @@ -841,7 +833,7 @@ class AbstractDownloadItem(QObject): return True if (url.scheme() == "http" and - origin.isValid() and origin.scheme() == "https" and + origin.scheme() == "https" and config.instance.get("downloads.prevent_mixed_content", url=origin)): self._die("Aborting insecure download from secure page " "(see downloads.prevent_mixed_content).") |