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

QFile on Android unable to open file content:// with space in the name

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P1: Critical
    • None
    • 6.4.3, 6.5.0
    • Core: I/O
    • None
    • Xiaomi Redmi Note 7,8
    • Android

    Description

      QFile on Android unable to open file content:// with space in the name

      In order to open file need to replace spaces to "%20".

      Workaround:

      #ifdef Q_OS_ANDROID
          // patch for files containing spaces etc
          const QString sep {"raw%3A%2F"};
          if (fileName.startsWith("content://") && fileName.contains(sep)) {
              QString contentUrl = fileName.split(sep).at(0);
              QString rawUrl = fileName.split(sep).at(1);
              rawUrl.replace(" ", "%20");
              fileName = contentUrl + sep + rawUrl;
          }
      #endif

      Attachments

        Activity

          People

            assam Assam Boudjelthia
            pokamest Anton Bulychev
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: