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

Regression 5.15.14: Cannot open Files from Android FileDialog with spaces or umlauts

    XMLWordPrintable

Details

    • Android
    • ea75e34d6 (dev), 9e0850b56 (6.6), 7c5bdf900 (6.5), d5e03ad4e (tqtc/lts-5.15), 813d989ad (tqtc/lts-6.2)
    • 2023wk28FOQtforAndroid, 2023wk30FOQtforAndroid, 2023wk32FOQtforAndroid

    Description

      There's a regression between Qt 5.15.7 and 5.15.13 or 14

      Using FileDialog to select Files and then read or copy them, correctly uses the native Android File Dialog and I can open/read/copy files as long as the filename only uses ASCII.

      Trying to open a File with Spaces inside the name as 'Unbenanntes Dokument.txt' or Umlauts as 'München.xlsx' works well on Android 10, but on Android 13 I'm getting

      W System.err: java.lang.SecurityException: Permission Denial: reading com.android.externalstorage.ExternalStorageProvider uri content://com.android.externalstorage.documents/document/primary%3ADocuments%2FUnbenanntes Dokument.txt from pid=29647, uid=10298 requires that you obtain access using ACTION_OPEN_DOCUMENT or related APIs
      W System.err:     at android.os.Parcel.createExceptionOrNull(Parcel.java:3011)
      W System.err:     at android.os.Parcel.createException(Parcel.java:2995)
      W System.err:     at android.os.Parcel.readException(Parcel.java:2978)
      W System.err:     at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:190)
      W System.err:     at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:142)
      W System.err:     at android.content.ContentProviderProxy.query(ContentProviderNative.java:481)
      W System.err:     at android.content.ContentResolver.query(ContentResolver.java:1219)
      W System.err:     at android.content.ContentResolver.query(ContentResolver.java:1151)
      W System.err:     at android.content.ContentResolver.query(ContentResolver.java:1107)
      W System.err:     at org.qtproject.qt5.android.QtNative.startQtApplication(Native Method)
      W System.err:     at org.qtproject.qt5.android.QtNative$7.run(QtNative.java:446)
      W System.err:     at org.qtproject.qt5.android.QtThread$1.run(QtThread.java:61)
      W System.err:     at java.lang.Thread.run(Thread.java:1012)

      As a workaround I tried replacing the space by '%20' and it works, but I didn't found a workaround to replace umlauts - tried different encodings.

      On 5.15.7 all filenames work.

      Easy to test this:

      QML
      FileDialog {
          id: myFileDialog
          title: "Select one or more files"
          selectExisting: true
          selectFolder: false
          selectMultiple : true
          onAccepted: {
              // CPP
              // check fileUrls[0] with QFileInfo
              // fileInfo.exists() is false if Spaces or Umlauts are part of the fileName and if Qt 5.15.13 or 14 and if Android 13
          }
      }
       

      Here my test results for file 'Unbenanntes Dokument.txt' with a space inside:

      5.15.7 - API 30
      Nokia 7.1, Android 10
      URL: content://com.android.providers.downloads.documents/document/344
      OK: exists and isReadable
      
      5.15.7 - API 30
      Pixel 6a, Android 13
      URL: content://com.android.externalstorage.documents/document/primary%3ADocuments%2FUnbenanntes Dokument.txt
      OK: exists and isReadable
      
      5.15.14 - API 31
      Nokia 7.1, Android 10
      URL: content://com.android.providers.downloads.documents/document/344
      OK: exists and isReadable
      
      5.15.14 - API 31
      Pixel 6a, Android 13
      URL: content://com.android.externalstorage.documents/document/primary%3ADocuments%2FUnbenanntes Dokument.txt
      FAILS: does NOT exists and so NOT readable
      
      Replacing spaces by '%20' the URL exists and is readbale
      
      

      .

      Attachments

        1. 01_A10_selectFolder.png
          01_A10_selectFolder.png
          56 kB
        2. 02_A10_selectFiles.png
          02_A10_selectFiles.png
          79 kB
        3. 03_A13_select_folder_download.png
          03_A13_select_folder_download.png
          142 kB
        4. 04_A13_select_folder_other.png
          04_A13_select_folder_other.png
          113 kB
        5. 05_A13_select_files.png
          05_A13_select_files.png
          95 kB
        6. München.xlsx
          9 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            assam Assam Boudjelthia
            ekkescorner Ekkehard
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews