Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-16426

QUrl::removeAllQueryItems leaves a trailing query delimiter when removing the last query item

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: P3: Somewhat important P3: Somewhat important
    • 5.0.0
    • 4.7.1
    • Core: URL Handling
    • None

      removeAllQueryItems leaves a trailing query delimiter (usually, the '&' character) when removing the last query item of an url. This is a problem since it will lead to empty query items accumulating at the end of the url.

      Example:

        QUrl url("http://example.com/?a=1&b=2");
        url.removeAllQueryItems("b");
        url.addQueryItem("b", "3");
        qDebug() << url; // QUrl( "http://example.com/?a=1&&b=3" )  <-- notice the two '&' characters
        //url.removeAllQueryItems(""); // Workaround: remove empty query items
      

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            thiago Thiago Macieira
            gregschlom Gregory Schlomoff
            Votes:
            2 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes