| Summary: | KUrl::htmlRef() return empty string whenever must return null string | ||
|---|---|---|---|
| Product: | [Unmaintained] kdelibs | Reporter: | Andrea Iacovitti <aiacovitti> |
| Component: | kdecore | Assignee: | kdelibs bugs <kdelibs-bugs-null> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | CC: | faure |
| Priority: | NOR | ||
| Version First Reported In: | unspecified | ||
| Target Milestone: | --- | ||
| Platform: | Unlisted Binaries | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
Git commit 9fbd6def08325b0b0acb97d19b8a07f99f099996 by David Faure. Committed on 23/06/2011 at 11:55. Pushed by dfaure into branch 'master'. Fix null/empty confusion in KUrl::htmlRef() and its unittests. Patch by Andrea Iacovitti <aiacovitti@libero.it>, who wrote: This aims to be a fix for bug #276204 related to htmlRef(), and the kurl unit test that return a false positive because of QCOMPARE treating QString("") == QString() After fixing the unit test related to url reference stuff, 2 of them failed. One related to htmlRef() (as in #276204), the other related to setRef() not able to set Empty (but not Null) ref. -> fixed setRef() too. CCBUG: 276204 M +4 -4 kdecore/io/kurl.cpp M +29 -9 kdecore/tests/kurltest.cpp M +1 -0 kdecore/tests/kurltest.h http://commits.kde.org/kdelibs/9fbd6def08325b0b0acb97d19b8a07f99f099996 OK, actually this fixes the bug, we can close it. Git commit 52718deb48f3419bf282b2059a45ac0ab8bde363 by Andrea Iacovitti. Committed on 21/07/2011 at 20:41. Pushed by aiacovitti into branch 'master'. Additional unittests for setRef() and setHTMLRef() CCBUG: 276204 M +6 -0 kdecore/tests/kurltest.cpp http://commits.kde.org/kdelibs/52718deb48f3419bf282b2059a45ac0ab8bde363 Git commit 7977f1a8d7145ddadebfc539eef8af7011bd897e by David Faure. Committed on 23/06/2011 at 11:55. Pushed by dfaure into branch 'KDE/4.7'. Fix null/empty confusion in KUrl::htmlRef() and its unittests. Patch by Andrea Iacovitti <aiacovitti@libero.it>, who wrote: This aims to be a fix for bug #276204 related to htmlRef(), and the kurl unit test that return a false positive because of QCOMPARE treating QString("") == QString() After fixing the unit test related to url reference stuff, 2 of them failed. One related to htmlRef() (as in #276204), the other related to setRef() not able to set Empty (but not Null) ref. -> fixed setRef() too. CCBUG: 276204 M +1 -0 kdecore/tests/kurltest.h M +4 -4 kdecore/io/kurl.cpp M +29 -9 kdecore/tests/kurltest.cpp http://commits.kde.org/kdelibs/7977f1a8d7145ddadebfc539eef8af7011bd897e Git commit f34fcae00b35716bee68df436a53630776591f91 by David Faure, on behalf of Andrea Iacovitti. Committed on 21/07/2011 at 20:41. Pushed by dfaure into branch 'KDE/4.7'. Additional unittests for setRef() and setHTMLRef() CCBUG: 276204 M +6 -0 kdecore/tests/kurltest.cpp http://commits.kde.org/kdelibs/f34fcae00b35716bee68df436a53630776591f91 |
Version: unspecified (using KDE 4.6.4) OS: Linux KUrl::htmlRef() return empty string whenever must return null string Consider an url u with no fragment part: KUrl u("http://www.kde.org") While u.ref() correctly return NULL string, u.htmlRef() return EMPTY string. That's not correct, u.htmlRef() must return NULL string too. Reproducible: Always Possible patch: --- kdelibs/kdecore/io/kurl.cpp +++ kdelibs/kdecore/io/kurl.cpp @@ -1490,11 +1490,11 @@ { if ( !hasSubUrl() ) { - return QUrl::fromPercentEncoding( ref().toLatin1() ); + return fragment(); } const List lst = split( *this ); - return QUrl::fromPercentEncoding( (*lst.begin()).ref().toLatin1() ); + return (*lst.begin()).fragment(); } QString KUrl::encodedHtmlRef() const