diff options
author | Konstantin Tokarev <annulen@yandex.ru> | 2016-12-26 00:24:34 +0300 |
---|---|---|
committer | Konstantin Tokarev <annulen@yandex.ru> | 2017-02-02 12:31:19 +0000 |
commit | b9e202b0f12f275d4aade98943df92bf67684f52 (patch) | |
tree | 4471f3da5f573679c3f42b0ad54c46bdd0a50910 /Source/WebKit2/NetworkProcess/Downloads/qt/QtFileDownloader.cpp | |
parent | 1c8f056531c65706b85c44c2db657ea891be868d (diff) | |
download | qtwebkit-b9e202b0f12f275d4aade98943df92bf67684f52.tar.gz |
Imported WebKit commit 12fbea815480c3b3fad139cd8dfb82e8c954bc9a
Change-Id: Iccbb1e8bd8b7f72322614224c203fc509a8dbb79
Reviewed-by: Konstantin Tokarev <annulen@yandex.ru>
Diffstat (limited to 'Source/WebKit2/NetworkProcess/Downloads/qt/QtFileDownloader.cpp')
-rw-r--r-- | Source/WebKit2/NetworkProcess/Downloads/qt/QtFileDownloader.cpp | 34 |
1 files changed, 1 insertions, 33 deletions
diff --git a/Source/WebKit2/NetworkProcess/Downloads/qt/QtFileDownloader.cpp b/Source/WebKit2/NetworkProcess/Downloads/qt/QtFileDownloader.cpp index 0ec67704c..abed3cd34 100644 --- a/Source/WebKit2/NetworkProcess/Downloads/qt/QtFileDownloader.cpp +++ b/Source/WebKit2/NetworkProcess/Downloads/qt/QtFileDownloader.cpp @@ -60,33 +60,6 @@ void QtFileDownloader::init() connect(m_reply.get(), SIGNAL(error(QNetworkReply::NetworkError)), SLOT(onError(QNetworkReply::NetworkError))); } -QString QtFileDownloader::determineFilename() -{ - ASSERT(!m_destinationFile); - - QString filenameCandidate = filenameFromHTTPContentDisposition(QString::fromLatin1(m_reply->rawHeader("Content-Disposition"))); - if (filenameCandidate.isEmpty()) { - URL kurl = m_reply->url(); - filenameCandidate = decodeURLEscapeSequences(kurl.lastPathComponent()); - } - - if (filenameCandidate.isEmpty()) { - abortDownloadWritingAndEmitError(QtFileDownloader::DownloadErrorCannotDetermineFilename); - return QString(); - } - - // Make sure that we remove possible "../.." parts in the given file name. - QFileInfo filenameFilter(filenameCandidate); - QString filename = filenameFilter.fileName(); - - if (filename.isEmpty()) { - abortDownloadWritingAndEmitError(QtFileDownloader::DownloadErrorCannotDetermineFilename); - return QString(); - } - - return filename; -} - void QtFileDownloader::startTransfer(const QString& decidedFilePath) { ASSERT(!m_destinationFile); @@ -172,17 +145,12 @@ void QtFileDownloader::handleDownloadResponse() String contentType = m_reply->header(QNetworkRequest::ContentTypeHeader).toString(); String encoding = extractCharsetFromMediaType(contentType); String mimeType = extractMIMETypeFromMediaType(contentType); - String filename = determineFilename(); - - // If filename is empty it means determineFilename aborted and emitted an error. - if (filename.isEmpty()) - return; // Let's try to guess from the extension. if (mimeType.isEmpty()) mimeType = MIMETypeRegistry::getMIMETypeForPath(m_reply->url().path()); - ResourceResponse response(m_reply->url(), mimeType, m_reply->header(QNetworkRequest::ContentLengthHeader).toLongLong(), encoding, filename); + ResourceResponse response(m_reply->url(), mimeType, m_reply->header(QNetworkRequest::ContentLengthHeader).toLongLong(), encoding); m_download->didReceiveResponse(response); } |