summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPeter Varga <pvarga@inf.u-szeged.hu>2021-09-30 17:25:21 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-10-13 14:05:46 +0000
commit72050abc798e7865f9e0e0657336227a89918413 (patch)
tree4b23c03d3ff1df479f21286f9d99806592475350 /src
parenta48f68c10f7ed13a0c6d249b0a8a791ebaae0634 (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 Change-Id: Icf0e472df723fc4f6ad36f4560509aafa69e3582 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> (cherry picked from commit b236a5a1abccaef2895f6f01577318464d6334b1) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src')
-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) {