Skip to content

ReactNativeBlobUtil.fs does not work if path contains 'content://' #365

@ABogdanovas

Description

@ABogdanovas

I'm encountering an issue with the fs.exists function in ReactNativeBlobUtil. The code I'm using is:
const fileExist = await ReactNativeBlobUtil.fs.exists(path ?? '');

When the file is located in the cache folder, the function works correctly and returns true if the file exists. However, when the file is not in the cache folder and the path contains 'content', such as content://com.android.providers.downloads.documents/document/msf%3A1000000018, the function always returns false.

Reproduction Steps:

Use a file path containing 'content' (e.g., content://com.android.providers.downloads.documents/document/msf%3A1000000018).
Call ReactNativeBlobUtil.fs.exists(path).
Observe that the function returns false, even if the file exists.
Expected Behavior:
The fs.exists function should correctly identify the existence of a file, even when the path includes 'content://'.

Additional Context:
I found a potential solution in another package that handles similar paths. The relevant implementation can be seen in the react-native-file-viewer repository:
solution(see line 50).

Proposed Solution:
Could you integrate a similar approach to handle 'content://' paths in your library? This would greatly enhance the functionality and reliability of fs.exists and similar methods.

Environment:

React Native Version: 0.73.6
ReactNativeBlobUtil Version: 0.19.9
Platform: Android
Thank you for your attention to this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions