mirror of
https://invent.kde.org/network/falkon.git
synced 2024-11-11 01:22:10 +01:00
Fixing download issue introduced in last commit.
This commit is contained in:
parent
14c7c08c44
commit
42d9e93363
|
@ -31,7 +31,12 @@ QObject* WebPluginFactory::create(const QString &mimeType, const QUrl &url, cons
|
|||
{
|
||||
QString mime = mimeType.trimmed(); //Fixing bad behaviour when mimeType contains spaces
|
||||
if (mime.isEmpty()) {
|
||||
return 0;
|
||||
if (url.toString().endsWith(".swf")) {
|
||||
mime = "application/x-shockwave-flash";
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (mime != "application/x-shockwave-flash") {
|
||||
|
|
|
@ -203,16 +203,23 @@ void WebPage::handleUnsupportedContent(QNetworkReply* reply)
|
|||
|
||||
switch (reply->error()) {
|
||||
case QNetworkReply::NoError:
|
||||
if (!reply->rawHeader("Content-Disposition").isEmpty()) {
|
||||
if (reply->header(QNetworkRequest::ContentTypeHeader).isValid()) {
|
||||
QString requestUrl = reply->request().url().toString(QUrl::RemoveFragment | QUrl::RemoveQuery);
|
||||
if (requestUrl.endsWith(".swf")) {
|
||||
QWebElement docElement = mainFrame()->documentElement();
|
||||
QWebElement object = docElement.findFirst(QString("object[src=\"%1\"]").arg(requestUrl));
|
||||
QWebElement embed = docElement.findFirst(QString("embed[src=\"%1\"]").arg(requestUrl));
|
||||
|
||||
if (!object.isNull() || !embed.isNull()) {
|
||||
qDebug() << "WebPage::UnsupportedContent" << url << "Attempt to download flash object on site!";
|
||||
reply->deleteLater();
|
||||
return;
|
||||
}
|
||||
}
|
||||
DownloadManager* dManager = mApp->downManager();
|
||||
dManager->handleUnsupportedContent(reply, this);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
qDebug() << "WebPage::UnsupportedContent" << url << "Attempt to download request without Content-Disposition header!";
|
||||
reply->deleteLater();
|
||||
return;
|
||||
}
|
||||
|
||||
case QNetworkReply::ProtocolUnknownError:
|
||||
qDebug() << "WebPage::UnsupportedContent" << url << "ProtocolUnknowError";
|
||||
|
|
Loading…
Reference in New Issue
Block a user