From 7c2a418857cd20e3e59852f0c1561a26f17d9825 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 13 Aug 2013 15:58:40 -0700 Subject: 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 --- tests/auto/corelib/io/qurl/tst_qurl.cpp | 5 +++++ 1 file changed, 5 insertions(+) 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 -- cgit v1.2.3