From 2adfdc031b9cdd655bd6b8d97c516b21296c4f72 Mon Sep 17 00:00:00 2001 From: Xiao YiFang Date: Wed, 24 Aug 2022 21:30:26 +0800 Subject: [PATCH] opt: resource file detection optimize --- utils.hh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/utils.hh b/utils.hh index 28db1830..21cf2818 100644 --- a/utils.hh +++ b/utils.hh @@ -95,7 +95,19 @@ inline bool isExternalLink(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",".gif", ".tif",".wav", ".ogg", ".oga", ".mp3", ".mp4", ".aac", ".flac",".mid", ".wv",".ape"} ; + QStringList extensions{ ".css", ".woff", ".woff2", ".ttf", ".otf", ".bmp", ".jpg", ".png", ".gif", ".tif", + ".wav", ".ogg", ".oga", ".mp3", ".mp4", ".aac", ".flac", ".mid", ".wv", ".ape" }; + + //some url has the form like https://xxxx/audio?file=***.mp3&a=1 etc links. + if( ext.isEmpty() ) + { + for( QString extension : extensions ) + { + if( url.url().contains( extension ) ) + return true; + } + return false; + } return extensions.contains( ext, Qt::CaseInsensitive ); }