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

QML does not load URIs with encoded directory separators

XMLWordPrintable

      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")
      

        For Gerrit Dashboard: QTBUG-25981
        # Subject Branch Project Status CR V

            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

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes