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

QML does not load URIs with encoded directory separators

    XMLWordPrintable

Details

    Description

      QML can load files specified with encoded characters (for example, "file:/tmp/test%23123/test.png", where the '#' character is percent-encoded), but not when the directory separators are encoded.

      For example, encoding the entire path as done here:

      source: "file:" + encodeURIComponent("/tmp/test#123/test.png")
      

      results in the error:

      file://<$PWD>%2Ftmp%2Ftest%23123%2Ftest.png: File not found
      

      (where <$PWD> is the working directory at invocation)

      This can be worked around via a helper function:

      function encodeURIComponents(uri) {
          return uri.split('/').map(encodeURIComponent).join('/')
      }
      
      source: "file:" + encodeURIComponents("/tmp/test#123/test.png")
      

      Attachments

        Issue Links

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

          Activity

            People

              mvogt Matthew Vogt (closed Nokia identity) (Inactive)
              mvogt Matthew Vogt (closed Nokia identity) (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes