mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 18:56:34 +01:00
Fixing download issue introduced in last commit.
This commit is contained in:
parent
14c7c08c44
commit
42d9e93363
@ -31,8 +31,13 @@ QObject* WebPluginFactory::create(const QString &mimeType, const QUrl &url, cons
|
|||||||
{
|
{
|
||||||
QString mime = mimeType.trimmed(); //Fixing bad behaviour when mimeType contains spaces
|
QString mime = mimeType.trimmed(); //Fixing bad behaviour when mimeType contains spaces
|
||||||
if (mime.isEmpty()) {
|
if (mime.isEmpty()) {
|
||||||
|
if (url.toString().endsWith(".swf")) {
|
||||||
|
mime = "application/x-shockwave-flash";
|
||||||
|
}
|
||||||
|
else {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (mime != "application/x-shockwave-flash") {
|
if (mime != "application/x-shockwave-flash") {
|
||||||
if (mime != "application/futuresplash" && mime != "application/x-java-applet") {
|
if (mime != "application/futuresplash" && mime != "application/x-java-applet") {
|
||||||
|
@ -203,14 +203,21 @@ void WebPage::handleUnsupportedContent(QNetworkReply* reply)
|
|||||||
|
|
||||||
switch (reply->error()) {
|
switch (reply->error()) {
|
||||||
case QNetworkReply::NoError:
|
case QNetworkReply::NoError:
|
||||||
if (!reply->rawHeader("Content-Disposition").isEmpty()) {
|
if (reply->header(QNetworkRequest::ContentTypeHeader).isValid()) {
|
||||||
DownloadManager* dManager = mApp->downManager();
|
QString requestUrl = reply->request().url().toString(QUrl::RemoveFragment | QUrl::RemoveQuery);
|
||||||
dManager->handleUnsupportedContent(reply, this);
|
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;
|
return;
|
||||||
}
|
}
|
||||||
else {
|
}
|
||||||
qDebug() << "WebPage::UnsupportedContent" << url << "Attempt to download request without Content-Disposition header!";
|
DownloadManager* dManager = mApp->downManager();
|
||||||
reply->deleteLater();
|
dManager->handleUnsupportedContent(reply, this);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user