diff options
author | Michael BrĂ¼ning <michael.bruning@qt.io> | 2021-01-18 16:03:25 +0100 |
---|---|---|
committer | Michael BrĂ¼ning <michael.bruning@qt.io> | 2021-01-22 15:05:17 +0100 |
commit | a134b801dc38feb536d4829213624dba72702d54 (patch) | |
tree | 1adf4907861cbaf4a7b01c895a90b521dfaf0aa8 /src/core/download_manager_delegate_qt.cpp | |
parent | 91b3a9c056af7e08aca49d8dc2393d23fe6acf85 (diff) |
Do not extract download file names from certain url schemes
Chromium uses the default download file name if the scheme of
a file to download is either about or data, as the file name extraction
methods do not seems to work for those.
Mimic this behavior in Qt WebEngine as well.
Fixes: QTBUG-90355
Change-Id: I14b8c4f64559500d3f231dd26533a5947bf94bc3
Reviewed-by: Michal Klocek <michal.klocek@qt.io>
Diffstat (limited to 'src/core/download_manager_delegate_qt.cpp')
-rw-r--r-- | src/core/download_manager_delegate_qt.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/core/download_manager_delegate_qt.cpp b/src/core/download_manager_delegate_qt.cpp index 1f6013cbb..f1ad1e677 100644 --- a/src/core/download_manager_delegate_qt.cpp +++ b/src/core/download_manager_delegate_qt.cpp @@ -162,8 +162,11 @@ bool DownloadManagerDelegateQt::DetermineDownloadTarget(download::DownloadItem * if (suggestedFilename.isEmpty()) suggestedFilename = toQt(item->GetTargetFilePath().AsUTF8Unsafe()); - if (suggestedFilename.isEmpty()) - suggestedFilename = QUrl::fromPercentEncoding(toQByteArray(item->GetURL().ExtractFileName())); + if (suggestedFilename.isEmpty()) { + GURL itemUrl = item->GetURL(); + if (!itemUrl.SchemeIs("about") && !itemUrl.SchemeIs("data")) + suggestedFilename = QUrl::fromPercentEncoding(toQByteArray(itemUrl.ExtractFileName())); + } if (suggestedFilename.isEmpty()) { suggestedFilename = QStringLiteral("qwe_download"); |