From e188210a33bbe25eadd5d71a6c73a1bee4fb411f Mon Sep 17 00:00:00 2001 From: Daniel Smith Date: Wed, 14 Oct 2015 13:03:24 +1300 Subject: [PATCH] Add compulsory prefix "tmp_" to temporary filename Fixes Issue #86. The call to `File.createTempFile` causes an `IllegalArgumentException` as it is expecting the filename parameter to be > 3 characters. Therefore a fatal error occurs when filename prefixes are less than 3 characters e.g.: 3.jpg, ab.jpg etc. To fix this I have added a compulsory prefix to the created temporary file. --- src/android/Library/src/MultiImageChooserActivity.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/android/Library/src/MultiImageChooserActivity.java b/src/android/Library/src/MultiImageChooserActivity.java index fb163853..25ca388e 100644 --- a/src/android/Library/src/MultiImageChooserActivity.java +++ b/src/android/Library/src/MultiImageChooserActivity.java @@ -617,7 +617,7 @@ private File storeImage(Bitmap bmp, String fileName) throws IOException { int index = fileName.lastIndexOf('.'); String name = fileName.substring(0, index); String ext = fileName.substring(index); - File file = File.createTempFile(name, ext); + File file = File.createTempFile("tmp_" + name, ext); OutputStream outStream = new FileOutputStream(file); if (ext.compareToIgnoreCase(".png") == 0) { bmp.compress(Bitmap.CompressFormat.PNG, quality, outStream);