From 3c0d694c430a3f8d1b8fbad02a1c9b7054478ccd Mon Sep 17 00:00:00 2001 From: Xiao YiFang Date: Mon, 11 Jul 2022 21:18:58 +0800 Subject: [PATCH] opt:whitelist add .gif resource --- utils.hh | 4 ++-- weburlrequestinterceptor.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/utils.hh b/utils.hh index 76661c6e..b71f7527 100644 --- a/utils.hh +++ b/utils.hh @@ -84,10 +84,10 @@ inline bool isExternalLink(QUrl const &url) { url.scheme() == "file" || url.toString().startsWith( "//" ); } -inline bool isCssFontImage(QUrl const &url) { +inline bool isHtmlResources(QUrl const &url) { auto fileName = url.fileName(); auto ext=fileName.mid(fileName.lastIndexOf(".")); - QStringList extensions{".css",".woff",".woff2","ttf",".bmp" ,".jpg", ".png", ".tif",".wav", ".ogg", ".oga", ".mp3", ".mp4", ".aac", ".flac",".mid", ".wv ",".ape"} ; + QStringList extensions{".css",".woff",".woff2","ttf",".bmp" ,".jpg", ".png",".gif", ".tif",".wav", ".ogg", ".oga", ".mp3", ".mp4", ".aac", ".flac",".mid", ".wv",".ape"} ; return extensions.indexOf(ext)>-1; } diff --git a/weburlrequestinterceptor.cpp b/weburlrequestinterceptor.cpp index 48573288..b817d0e0 100644 --- a/weburlrequestinterceptor.cpp +++ b/weburlrequestinterceptor.cpp @@ -21,7 +21,7 @@ void WebUrlRequestInterceptor::interceptRequest( QWebEngineUrlRequestInfo &info) //whitelist url does not block return; } - if(Utils::isCssFontImage(info.requestUrl())){ + if(Utils::isHtmlResources(info.requestUrl())){ //let throuth the resources file. return; }