Skip to content
This repository has been archived by the owner on Jan 2, 2023. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Remove query string from failed url, before handling error
Currently wkhtmltox don't ignore media errors for URL with a query string whereas
load-media-error-handling takes 'ignore' value. This is due to QFileInfo::completeSuffix()
returning extension as well as qs.

This little fix circumvents this issue by removing everything using regexp: '\?.*$'.
  • Loading branch information
Albin Kerouanton authored and ashkulz committed Aug 18, 2017
1 parent 163e124 commit 333521a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/lib/multipageloader.cc
Expand Up @@ -397,7 +397,8 @@ void ResourceObject::amfinished(QNetworkReply * reply) {
if ((networkStatus != 0 && networkStatus != 5) || (httpStatus > 399 && httpErrorCode == 0))
{
QFileInfo fi(reply->url().toString());
bool mediaFile = settings::LoadPage::mediaFilesExtensions.contains(fi.completeSuffix().toLower());
QString extension = fi.completeSuffix().toLower().remove(QRegExp("\\?.*$"));
bool mediaFile = settings::LoadPage::mediaFilesExtensions.contains(extension);
if ( ! mediaFile) {
// XXX: Notify network errors as higher priority than HTTP errors.
// QT's QNetworkReply::NetworkError enum uses values overlapping
Expand Down

0 comments on commit 333521a

Please sign in to comment.