summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/corelib/io/qurl.cpp10
-rw-r--r--tests/auto/corelib/io/qurl/tst_qurl.cpp2
2 files changed, 7 insertions, 5 deletions
diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp
index 5cc49c8192..44160b3d8b 100644
--- a/src/corelib/io/qurl.cpp
+++ b/src/corelib/io/qurl.cpp
@@ -2076,14 +2076,16 @@ QUrl QUrl::resolved(const QUrl &relative) const
}
/*!
- Returns true if the URL is relative; otherwise returns false. A
- URL is relative if its scheme is undefined; this function is
- therefore equivalent to calling scheme().isEmpty().
+ Returns true if the URL is relative; otherwise returns false. A URL is
+ relative reference if its scheme is undefined; this function is therefore
+ equivalent to calling scheme().isEmpty().
+
+ Relative references are defined in RFC 3986 section 4.2.
*/
bool QUrl::isRelative() const
{
if (!d) return true;
- return !d->hasScheme() && !d->path.startsWith(QLatin1Char('/'));
+ return !d->hasScheme();
}
/*!
diff --git a/tests/auto/corelib/io/qurl/tst_qurl.cpp b/tests/auto/corelib/io/qurl/tst_qurl.cpp
index 2b7a467192..31acd1aaa7 100644
--- a/tests/auto/corelib/io/qurl/tst_qurl.cpp
+++ b/tests/auto/corelib/io/qurl/tst_qurl.cpp
@@ -1621,7 +1621,7 @@ void tst_QUrl::isRelative_data()
QTest::newRow("man: URL, is relative") << "man:mmap" << false;
QTest::newRow("javascript: URL, is relative") << "javascript:doSomething()" << false;
QTest::newRow("file: URL, is relative") << "file:/blah" << false;
- QTest::newRow("/path, is relative") << "/path" << false;
+ QTest::newRow("/path, is relative") << "/path" << true;
QTest::newRow("something, is relative") << "something" << true;
// end kde
}