Skip to content

Commit c2dcfb0

Browse files
authored
fix: fs.hash Error: No such file 'file:///data/user/0/PATH_TO_READ.jpg'
for example ```js import { launchImageLibrary } from "react-native-image-picker"; import ReactNativeBlobUtil from "react-native-blob-util"; launchImageLibrary({ mediaType: "mixed", quality: 0.6, }) .then((d) => d.assets) .then((files) => { console.log("文件路径:", files[0].uri); return ReactNativeBlobUtil.fs.hash(files[0].uri, "sha256"); }) .then((fileHash) => { console.log("hash sha256"); console.log(fileHash); }) .catch((e) => { console.log(e); console.log("??"); }); ```
1 parent 1512092 commit c2dcfb0

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

android/src/main/java/com/ReactNativeBlobUtil/ReactNativeBlobUtilFS.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -790,6 +790,8 @@ static void hash(String path, String algorithm, Promise promise) {
790790
promise.reject("EINVAL", "Invalid algorithm '" + algorithm + "', must be one of md5, sha1, sha224, sha256, sha384, sha512");
791791
return;
792792
}
793+
794+
path = ReactNativeBlobUtilUtils.normalizePath(path);
793795

794796
File file = new File(path);
795797

0 commit comments

Comments
 (0)