From aec68f123a4f0f9e8a76e22b6d1505f114a88fe9 Mon Sep 17 00:00:00 2001 From: Dave Allie Date: Wed, 16 Nov 2022 01:26:07 +1100 Subject: [PATCH] Parse href in findLinks with QUrl::fromPercentEncoding This allows for both internal and external links containing percent escaped characters to be parsed correctly. Previously, http://example.com/foo%26bar was parsed as http://example.com/foo%2526bar instead of http://example.com/foo%26bar (http://example.com/foo&bar). Same issue for other escaped characters. According to the docs for the QUrl constructor, in it's default parsing using TolerantMode, it'll only transform %20 back to space, and will treat all other % signs as raw symbols to be encoded. --- src/lib/pdfconverter.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/pdfconverter.cc b/src/lib/pdfconverter.cc index b0e668339..399346fd3 100644 --- a/src/lib/pdfconverter.cc +++ b/src/lib/pdfconverter.cc @@ -566,7 +566,7 @@ void PdfConverterPrivate::findLinks(QWebFrame * frame, QVectorbaseUrl().resolved(href); QString key = QUrl::fromPercentEncoding(href.toString(QUrl::RemoveFragment).toLocal8Bit());