itinance / itinance/react-native-fs

readDir() issue - remove special characters in filename before extension

Open
#1,140 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
5k
Forks
1k
PR merge metrics
No merged PRs in 30d

Description

__Code :__
```js
RNFS.readDir(RNFS.DocumentDirectoryPath)
then(files => {
console.log(files);
});
```
Output :
```
[{"ctime": null, "isDirectory": [Function isDirectory], "isFile": [Function isFile], "mtime": 2022-10-18T11:11:40.000Z, "name": "rnimagepickerlibtemp7f38bfde14874f0d90d510751ec5e577.jpg", "path": "/data/user/0/com.project/files/rnimagepickerlibtemp7f38bfde14874f0d90d510751ec5e577.jpg", "size": 281600}, ...
```
Expected output :
```
[{"ctime": null, "isDirectory": [Function isDirectory], "isFile": [Function isFile], "mtime": 2022-10-18T11:11:40.000Z, "name": "rn_image_picker_lib_temp_632e4cf6-483e-4cfa-bbbb-b4608992e2e7.jpg", "path": "/data/user/0/com.project/files/rn_image_picker_lib_temp_632e4cf6-483e-4cfa-bbbb-b4608992e2e7.jpg, "size": 281600}, ...
```

`readDir()` removes "_" and "-".

**Environment**
```
System:
OS: macOS 12.6
CPU: (4) x64 Intel(R) Core(TM) i7-5557U CPU @ 3.10GHz
Memory: 34.82 MB / 16.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 16.15.1 - /usr/local/bin/node
Yarn: Not Found
npm: 8.19.2 - /usr/local/bin/npm
Watchman: 2022.10.10.00 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.11.3 - /Users/erylenn/.rbenv/versions/2.7.5/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 21.4, iOS 16.0, macOS 12.3, tvOS 16.0, watchOS 9.0
Android SDK: Not Found
IDEs:
Android Studio: 2021.2 AI-212.5712.43.2112.8609683
Xcode: 14.0/14A309 - /usr/bin/xcodebuild
Languages:
Java: 11.0.16.1 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 18.0.0 => 18.0.0
react-native: 0.69.6 => 0.69.6
react-native-macos: Not Found
npmGlobalPackages:
*react-native*: Not Found
```
`react-native-fs`: 2.20.0

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.