summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Varga <pvarga@inf.u-szeged.hu>2021-09-30 17:25:21 +0200
committerPeter Varga <pvarga@inf.u-szeged.hu>2021-10-12 11:04:09 +0000
commitb236a5a1abccaef2895f6f01577318464d6334b1 (patch)
tree1804d41fb3202496cf50066db0e8c8137860c1f0
parentff54ccc82fdba26cf16b9a64b387e3b428fb3038 (diff)
Workaround for downloading file into the root directory on Windows
A bug in QtBase breaks downloading files into a root directory on Windows (eg. C:\): QTBUG-85997 Check if the "non-existent" directory is an existing drive and do not cancel the download in this case. Fixes: QTBUG-96855 Pick-to: 6.2 Change-Id: Icf0e472df723fc4f6ad36f4560509aafa69e3582 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
-rw-r--r--src/core/download_manager_delegate_qt.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/core/download_manager_delegate_qt.cpp b/src/core/download_manager_delegate_qt.cpp
index b7b744603..58f6507a7 100644
--- a/src/core/download_manager_delegate_qt.cpp
+++ b/src/core/download_manager_delegate_qt.cpp
@@ -204,8 +204,16 @@ bool DownloadManagerDelegateQt::DetermineDownloadTarget(download::DownloadItem *
QFileInfo suggestedFile(info.path);
if (info.accepted && !suggestedFile.absoluteDir().mkpath(suggestedFile.absolutePath())) {
+#if defined(OS_WIN)
+ // TODO: Remove this when https://bugreports.qt.io/browse/QTBUG-85997 is fixed.
+ QDir suggestedDir = QDir(suggestedFile.absolutePath());
+ if (!suggestedDir.isRoot() || !suggestedDir.exists()) {
+#endif
qWarning("Creating download path failed, download cancelled: %s", suggestedFile.absolutePath().toUtf8().data());
info.accepted = false;
+#if defined(OS_WIN)
+ }
+#endif
}
if (!info.accepted) {