ammarahm-ed / react-native-scoped-storage

MIT License
59 stars 10 forks source link

deleteFile deletes the entire directory it is in when attempting to only delete one file #35

Open mitchdowney opened 2 years ago

mitchdowney commented 2 years ago

When I call deleteFile with:

await ScopedStorage.deleteFile('content://com.android.externalstorage.documents/tree/01F6-AC3F%3APodverse/document/01F6-AC3F%3APodverse/esgi0q1Pm.mp3')

RNSS deletes the entire directory instead of just deleting the .mp3 file. Is my content uri structured incorrectly?

It would be a disaster if we accidentally deleted a directory for the user. Shouldn't deleteFile and deleteDirectory be separate functions? That way, in the worst case, deleteFile could be safe-guarded to make sure deleting a directory by accident is not possible.

ammarahm-ed commented 2 years ago

Hmm 🤔 I will look into this tomorrow.