Skip to content

Commit

Permalink
fix:iframe add extra extension to passthrough when enabled ad block.
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoyifang committed May 17, 2022
1 parent bb3924e commit 949f463
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion iframeschemehandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,12 @@ void IframeSchemeHandler::requestStarted(QWebEngineUrlRequestJob *requestJob)
QBuffer * buffer = new QBuffer(requestJob);
buffer->setData(codec->fromUnicode(articleString));

requestJob->reply( "text/html;charset=UTF-8", buffer );
QByteArray contentType="text/html;charset=UTF-8";
auto contentTypeHeader=reply->header(QNetworkRequest::ContentTypeHeader);
if(contentTypeHeader.isValid())
contentType= contentTypeHeader.toByteArray();

requestJob->reply(contentType , buffer );
};
connect( reply, &QNetworkReply::finished, requestJob, finishAction );

Expand Down
2 changes: 1 addition & 1 deletion utils.hh
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ inline bool isExternalLink(QUrl const &url) {
inline bool isCssFontImage(QUrl const &url) {
auto fileName = url.fileName();
auto ext=fileName.mid(fileName.lastIndexOf("."));
QStringList extensions{".css",".woff",".woff2",".bmp" ,".jpg", ".png", ".tif",".wav", ".ogg", ".oga", ".mp3", ".mp4", ".aac", ".flac",".mid", ".wv ",".ape"} ;
QStringList extensions{".css",".woff",".woff2","ttf",".bmp" ,".jpg", ".png", ".tif",".wav", ".ogg", ".oga", ".mp3", ".mp4", ".aac", ".flac",".mid", ".wv ",".ape"} ;
return extensions.indexOf(ext)>-1;
}

Expand Down

0 comments on commit 949f463

Please sign in to comment.