Skip to content

Commit 41231a0

Browse files
Merge pull request #826 from giautm/patch-1
fix: share photo functionality
2 parents bf31df3 + 4e1c34d commit 41231a0

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

package/expo-package/src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ registerNativeHandlers({
123123
},
124124
saveFile: async ({ fileName, fromUrl }) => {
125125
try {
126-
const path = FileSystem.documentDirectory + fileName;
126+
const path = FileSystem.cacheDirectory + encodeURIComponent(fileName);
127127
const downloadedImage = await FileSystem.downloadAsync(fromUrl, path);
128128
return downloadedImage.uri;
129129
} catch (error) {

package/native-package/src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ registerNativeHandlers({
154154
},
155155
saveFile: async ({ fileName, fromUrl }) => {
156156
try {
157-
const path = RNFS.DocumentDirectoryPath + '/' + fileName;
157+
const path = RNFS.CachesDirectoryPath + '/' + encodeURIComponent(fileName);
158158
await RNFS.downloadFile({ fromUrl, toFile: path }).promise;
159159
return 'file://' + path;
160160
} catch (error) {

0 commit comments

Comments
 (0)