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

QML url type automatically performs some URL decoding

XMLWordPrintable

    • All
    • 8a3f8595569a920cf2fa811704dec97ae31be15d (qt/qtdeclarative/dev)

      Assigning a string containing URL-encoded characters (e.g. %25) to a QML property of type url automatically converts some of these to their decoded characters.

      This is bad if a webserver expects, for example, the actual "%25" instead of "/".

      Qt.resolvedUrl() also changes some of those characters.

      Code examples:

        // contains the original string
        property string origUrlStr: "https://test.com/a%20b%2fc%25d"
      
        // contains "https://test.com/a b/c%25d"
        property url origUrl: origUrlStr
      
        // contains https://test.com/a b%2fc%25d
        property string resolvedUrlStr: Qt.resolvedUrl(origUrlStr)
      
        // contains https://test.com/a b/c%25d
        property url resolvedUrl: Qt.resolvedUrl(origUrlStr)
      

      As a result, it is impossible to use this URL as the source of a QML Image:
      https://firebasestorage.googleapis.com/v0/b/vplaytest-9b010.appspot.com/o/images%2Fvplay-logo.png?alt=media&token=482900ca-e65e-4df2-8df3-cfade271ec8b

      Because the "%2F" is changed to "/" and the server then returns status 400:
      https://firebasestorage.googleapis.com/v0/b/vplaytest-9b010.appspot.com/o/images/vplay-logo.png?alt=media&token=482900ca-e65e-4df2-8df3-cfade271ec8b

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

            ulherman Ulf Hermann
            Chrisu Christian Bartsch
            Votes:
            4 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes