From 11f1c8f36910ed3c391ac7bd9ce18b1911d45a55 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Tue, 5 Aug 2014 18:02:12 +0200 Subject: [PATCH] Don't default all directories to DownloadPath if empty --- qutebrowser/browser/downloads.py | 5 ++++- qutebrowser/config/conftypes.py | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/qutebrowser/browser/downloads.py b/qutebrowser/browser/downloads.py index c7575a951..51ee1c15e 100644 --- a/qutebrowser/browser/downloads.py +++ b/qutebrowser/browser/downloads.py @@ -24,7 +24,7 @@ import os.path from functools import partial from collections import deque -from PyQt5.QtCore import pyqtSlot, pyqtSignal, QObject, QTimer +from PyQt5.QtCore import pyqtSlot, pyqtSignal, QObject, QTimer, QStandardPaths from PyQt5.QtNetwork import QNetworkRequest, QNetworkReply import qutebrowser.config.config as config @@ -211,6 +211,9 @@ class DownloadItem(QObject): target = os.path.expanduser(filename) else: download_dir = config.get('storage', 'download-directory') + if download_dir is None: + download_dir = get_standard_dir( + QStandardPaths.DownloadLocation) target = os.path.join(download_dir, filename) logger.debug("Setting filename to {}".format(filename)) if self.filename is not None: diff --git a/qutebrowser/config/conftypes.py b/qutebrowser/config/conftypes.py index 293724129..2d2e416b3 100644 --- a/qutebrowser/config/conftypes.py +++ b/qutebrowser/config/conftypes.py @@ -24,7 +24,7 @@ import shlex import os.path from sre_constants import error as RegexError -from PyQt5.QtCore import QUrl, QStandardPaths +from PyQt5.QtCore import QUrl from PyQt5.QtGui import QColor, QFont from PyQt5.QtNetwork import QNetworkProxy @@ -800,7 +800,7 @@ class Directory(BaseType): def transform(self, value): if not value: - return get_standard_dir(QStandardPaths.DownloadLocation) + return None return os.path.expanduser(value)