Commit 6f92911e authored by Allan Sandfeld Jensen's avatar Allan Sandfeld Jensen
Browse files

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: default avatarJoerg Bornemann <joerg.bornemann@theqtcompany.com>
Showing with 4 additions and 0 deletions
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#include "content/public/browser/download_item.h" #include "content/public/browser/download_item.h"
#include "content/public/browser/save_page_type.h" #include "content/public/browser/save_page_type.h"
#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents.h"
#include "net/http/http_content_disposition.h"
#include <QDir> #include <QDir>
#include <QFile> #include <QFile>
...@@ -103,6 +104,9 @@ bool DownloadManagerDelegateQt::DetermineDownloadTarget(content::DownloadItem* i ...@@ -103,6 +104,9 @@ bool DownloadManagerDelegateQt::DetermineDownloadTarget(content::DownloadItem* i
std::string suggestedFilename = item->GetSuggestedFilename(); std::string suggestedFilename = item->GetSuggestedFilename();
if (suggestedFilename.empty())
suggestedFilename = net::HttpContentDisposition(item->GetContentDisposition(), std::string()).filename();
if (suggestedFilename.empty()) if (suggestedFilename.empty())
suggestedFilename = item->GetTargetFilePath().AsUTF8Unsafe(); suggestedFilename = item->GetTargetFilePath().AsUTF8Unsafe();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment