Skip to content

Commit

Permalink
opt: resource file detection optimize
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoyifang committed Aug 24, 2022
1 parent 5180dfb commit 2adfdc0
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion utils.hh
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}

Expand Down

0 comments on commit 2adfdc0

Please sign in to comment.