MM-22963 Fix Android post GIF from keyboard (#3996)

This commit is contained in:
Elias Nahum 2020-03-04 08:44:11 -03:00 committed by GitHub
parent 06f03d88e9
commit 6eb7b5d682
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -19,6 +19,7 @@ import com.mattermost.share.RealPathUtil;
import com.mattermost.share.ShareModule;
import java.io.FileNotFoundException;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.regex.Matcher;
@ -133,9 +134,16 @@ public class RNPasteableEditTextOnPasteListener implements RNEditTextOnPasteList
private String moveToImagesCache(String src, String fileName) {
ReactContext ctx = (ReactContext)mEditText.getContext();
String dest = ctx.getCacheDir().getAbsolutePath() + "/Images/" + fileName;
String cacheFolder = ctx.getCacheDir().getAbsolutePath() + "/Images/";
String dest = cacheFolder + fileName;
File folder = new File(cacheFolder);
try {
if (!folder.exists()) {
folder.mkdirs();
}
Files.move(Paths.get(src), Paths.get(dest));
} catch (Exception err) {
return null;