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

FileDialog unwanted uri suffix for Android11 SAF

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reported
    • Priority: P2: Important
    • Resolution: Unresolved
    • Affects Version/s: 5.12.2
    • Fix Version/s: None
    • Labels:
      None
    • Platform/s:
      Android

      Description

       

      import QtQuick 2.15
      import QtQuick.Controls 2.15
      import Qt.labs.platform 1.1
      
      ApplicationWindow {
          width: 640
          height: 480
          visible: true
          title: qsTr("Test")
          Image {
              source: fileDialog.file
          }
          Button{
              text: "Open"
              onClicked: {
                  fileDialog.open()
              }
          }
          FileDialog {
              id: fileDialog
              defaultSuffix: "jpg"
              onAccepted: {
                  console.log(file)
              }
          }
      }

      This code works fine on the desktop

       

      But on Android 11 it will return uri:

      content://com.android.providers.media.documents/document/image:36.jpg
      

      Here .jpg is redundant and unnecessary

      This caused the file to fail to open

       

        Attachments

          Issue Links

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

            Activity

              People

              Assignee:
              qtandroidteam Qt Android Team
              Reporter:
              yjbeetle yjbeetle
              Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:

                  Gerrit Reviews

                  There are no open Gerrit changes