summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2013-08-13 15:58:40 -0700
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-08-23 21:39:23 +0200
commit7c2a418857cd20e3e59852f0c1561a26f17d9825 (patch)
treed49f572880b5b434bcbff83da9ffeb84afc34a45 /tests
parent043b80919747676c2df4b4423ed5950583233d30 (diff)
Add unit test to ensure %3A in a path isn't decoded to ':'
QUrl("http%3A%2F%2Fexample.com") has only a path of "http%3A%2F%2Fexample.com". In Qt 5.0 and 5.1, the %3A would get decoded to ':', which in turn makes the URL invalid (colon before first slash). Found via discussion on the interest mailing list. Change-Id: I7f4f242b330df280e635eb97cce123e742aa1b10 Reviewed-by: David Faure <david.faure@kdab.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/corelib/io/qurl/tst_qurl.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/auto/corelib/io/qurl/tst_qurl.cpp b/tests/auto/corelib/io/qurl/tst_qurl.cpp
index 81ee8f0be6..2fc0ea5c2a 100644
--- a/tests/auto/corelib/io/qurl/tst_qurl.cpp
+++ b/tests/auto/corelib/io/qurl/tst_qurl.cpp
@@ -3368,6 +3368,11 @@ void tst_QUrl::setComponents_data()
QTest::newRow("path-empty") << QUrl("http://example.com/path")
<< int(Path) << "" << Tolerant << true
<< PrettyDecoded << "" << "http://example.com";
+ // If the %3A gets decoded to ":", the URL becomes invalid;
+ // see test path-invalid-1 below
+ QTest::newRow("path-%3A-before-slash") << QUrl()
+ << int(Path) << "c%3A/" << Tolerant << true
+ << PrettyDecoded << "c%3A/" << "c%3A/";
// the other fields can be present and be empty
// that is, their delimiters would be present, but there would be nothing to one side