Fix a bug when the file name contains slashes. (#775)

It can happen when selecting an image downloaded from Weibo app.
This commit is contained in:
starzle 2018-08-20 19:20:45 +08:00 committed by Ivan Pusic
parent 0e6f877f27
commit 9ce13581da

View File

@ -103,6 +103,7 @@ class RealPathUtil {
private static File writeToFile(Context context, String fileName, Uri uri) {
String tmpDir = context.getCacheDir() + "/react-native-image-crop-picker";
Boolean created = new File(tmpDir).mkdir();
fileName = fileName.substring(fileName.lastIndexOf('/') + 1);
File path = new File(tmpDir);
File file = new File(path, fileName);
try {