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: Fixed
    • P1: Critical
    • 5.15.14, 6.2.9, 6.5.2, 6.6.0
    • 6.4.3, 6.5.0
    • Core: I/O
    • None
    • Xiaomi Redmi Note 7,8
    • Android
    • ac8a39c41 (dev), c685d7272 (6.5), 625bbfcb5 (tqtc/lts-6.2), 8ff1d6706 (tqtc/lts-5.15)
    • 2023wk18FOQtforAndroid

    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

        Issue Links

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

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes