summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2015-09-18 17:43:43 +0200
committerAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2015-09-30 09:23:00 +0000
commit6f92911e10fe4417c83af4ee356fd89549db29c6 (patch)
tree1e2058b9480b426c0db9556ae702c786296f7df8
parente643f766fa23ee73f7095d7ba20a385cef0f25a0 (diff)
Parse suggested filename from content-disposition
Chromium hasn't parsed content-disposition by the time we get the download item, so we need to call the parsing manually. Change-Id: I105d0c6904dd764b368cb774e377a6028c082513 Task-number: QTBUG-48206 Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
-rw-r--r--src/core/download_manager_delegate_qt.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/core/download_manager_delegate_qt.cpp b/src/core/download_manager_delegate_qt.cpp
index c01dcf63d..e9af98fd8 100644
--- a/src/core/download_manager_delegate_qt.cpp
+++ b/src/core/download_manager_delegate_qt.cpp
@@ -40,6 +40,7 @@
#include "content/public/browser/download_item.h"
#include "content/public/browser/save_page_type.h"
#include "content/public/browser/web_contents.h"
+#include "net/http/http_content_disposition.h"
#include <QDir>
#include <QFile>
@@ -104,6 +105,9 @@ bool DownloadManagerDelegateQt::DetermineDownloadTarget(content::DownloadItem* i
std::string suggestedFilename = item->GetSuggestedFilename();
if (suggestedFilename.empty())
+ suggestedFilename = net::HttpContentDisposition(item->GetContentDisposition(), std::string()).filename();
+
+ if (suggestedFilename.empty())
suggestedFilename = item->GetTargetFilePath().AsUTF8Unsafe();
if (suggestedFilename.empty())