Details
-
Bug
-
Resolution: Fixed
-
P1: Critical
-
5.15.13, 5.15.14
-
None
-
macOS 12.6.3
Qt 5.15.13 or 5.15.14
-
-
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
For Gerrit Dashboard: QTBUG-114435 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
495854,2 | Android: fix content URI handling for non-ascii file names | dev | qt/qtbase | Status: MERGED | +2 | 0 |
496682,2 | Android: fix content URI handling for non-ascii file names | 6.6 | qt/qtbase | Status: MERGED | +2 | 0 |
496683,2 | Android: fix content URI handling for non-ascii file names | 6.5 | qt/qtbase | Status: MERGED | +2 | 0 |
496690,3 | Android: fix content URI handling for non-ascii file names | tqtc/lts-5.15 | qt/tqtc-qtbase | Status: MERGED | +2 | 0 |
496691,3 | Android: fix content URI handling for non-ascii file names | tqtc/lts-6.2 | qt/tqtc-qtbase | Status: MERGED | +2 | 0 |