Revert QUrl::isRelative to its Qt 4 behaviour
Instead of trying to return whether the URL is relative to something undefined, let's instead follow what the documentation was saying all along and what the RFC says about "Relative References". Change-Id: I32722321a6b36c6e3480669ad769390e4c6f7d1c Reviewed-by: Lars Knoll <lars.knoll@nokia.com>bb10
parent
0df1c9f1fa
commit
6159870348
|
|
@ -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();
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue