summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlbert Astals Cid <aacid@kde.org>2020-03-01 19:08:02 +0100
committerAlbert Astals Cid <tsdgeos@yahoo.es>2020-03-01 18:08:52 +0000
commit84c52530992f28fc0623747ee505baad7a9bb287 (patch)
tree9c5ed57d17943d30341d4eaf8de4bcd68dd0f24c
parentb3cfbbf2679618d0c32670090717a6e2f70faf9c (diff)
Fix regression in URI link handling
-rw-r--r--poppler/Link.cc1
-rw-r--r--qt5/tests/check_links.cpp23
2 files changed, 24 insertions, 0 deletions
diff --git a/poppler/Link.cc b/poppler/Link.cc
index c9945ce8..790c41ab 100644
--- a/poppler/Link.cc
+++ b/poppler/Link.cc
@@ -519,6 +519,7 @@ LinkLaunch::LinkLaunch(const Object *actionObj) {
LinkURI::LinkURI(const Object *uriObj, const GooString *baseURI) {
hasURIFlag = false;
if (uriObj->isString()) {
+ hasURIFlag = true;
const std::string& uri2 = uriObj->getString()->toStr();
size_t n = strcspn(uri2.c_str(), "/:");
if (n < uri2.size() && uri2[n] == ':') {
diff --git a/qt5/tests/check_links.cpp b/qt5/tests/check_links.cpp
index 5927d623..0ec7ddbb 100644
--- a/qt5/tests/check_links.cpp
+++ b/qt5/tests/check_links.cpp
@@ -13,6 +13,7 @@ private slots:
void checkDocumentWithNoDests();
void checkDests_xr01();
void checkDests_xr02();
+ void checkDocumentURILink();
};
static bool isDestinationValid_pageNumber( const Poppler::LinkDestination *dest, const Poppler::Document *doc )
@@ -95,6 +96,28 @@ void TestLinks::checkDests_xr02()
delete doc;
}
+void TestLinks::checkDocumentURILink()
+{
+ Poppler::Document *doc;
+ doc = Poppler::Document::load(TESTDATADIR "/unittestcases/checkbox_issue_159.pdf");
+ QVERIFY( doc );
+
+ Poppler::Page *page = doc->page(0);
+ QVERIFY( page );
+
+ QList< Poppler::Link* > links = page->links();
+ QCOMPARE( links.count(), 1 );
+
+ QCOMPARE( links.at(0)->linkType(), Poppler::Link::Browse );
+ Poppler::LinkBrowse *link = static_cast< Poppler::LinkBrowse * >( links.at(0) );
+ QCOMPARE( link->url(), QLatin1String("http://www.tcpdf.org") );
+
+ qDeleteAll(links);
+ delete page;
+ delete doc;
+}
+
+
QTEST_GUILESS_MAIN(TestLinks)
#include "check_links.moc"