Merge pull request #365 from xiaoyifang/fix/wiki-request

fix:wikipedia url request
This commit is contained in:
xiaoyifang 2023-03-02 21:52:10 +08:00 committed by GitHub
commit 7273f84682
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -617,6 +617,10 @@ void MediaWikiArticleRequest::requestFinished( QNetworkReply * r )
// Add url scheme to other urls like "//xxx"
articleString.replace( " href=\"//", " href=\"" + wikiUrl.scheme() + "://" );
// Add url scheme to other urls like embed css background: url("//upload.wikimedia.org/wikipedia/commons/6/65/Lock-green.svg")right 0.1em center/9px no-repeat
articleString.replace( "url(\"//", "url(\"" + wikiUrl.scheme() + "://" );
// Fix urls in "srcset" attribute
pos = 0;
QRegularExpression regSrcset( R"( srcset\s*=\s*"/[^"]+")" );