mozilla/geckoview

bug: Uri cannot be used.

jeesk opened this issue · 0 comments

jeesk commented

when i open android system file selector, the uri is
content://com.android.providers.media.documents/document/image%3A764691,
getFile() is null,

      public @NonNull PromptResponse confirm(
          @NonNull final Context context, @NonNull final Uri[] uris) {
        if (Type.SINGLE == type && (uris == null || uris.length != 1)) {
          throw new IllegalArgumentException();
        }

        final String[] paths = new String[uris != null ? uris.length : 0];
        for (int i = 0; i < paths.length; i++) {
          paths[i] = getFile(context, uris[i]);
          if (paths[i] == null) {
            Log.e(LOGTAG, "Only file URIs are supported: " + uris[i]);
          }
        }
        ensureResult().putStringArray("files", paths);

        return super.confirm();
      }