Skip to content

Commit e1c4181

Browse files
committed
🐛 fix android bug where a file attachment added from the cache directory was not being sent to the dashboard
1 parent 9ddd845 commit e1c4181

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

android/src/main/java/com/instabug/reactlibrary/RNInstabugReactnativeModule.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
import org.json.JSONObject;
6060
import org.json.JSONTokener;
6161

62+
import java.io.File;
6263
import java.lang.reflect.InvocationTargetException;
6364
import java.lang.reflect.Method;
6465
import java.util.ArrayList;
@@ -457,8 +458,10 @@ public void setVideoRecordingFloatingButtonPosition(String corner) {
457458
@ReactMethod
458459
public void setFileAttachment(String fileUri, String fileNameWithExtension) {
459460
try {
460-
Uri uri = Uri.parse(fileUri);
461-
Instabug.addFileAttachment(uri, fileNameWithExtension);
461+
File file = new File(fileUri);
462+
if (file.exists()) {
463+
Instabug.addFileAttachment(Uri.fromFile(file), fileNameWithExtension);
464+
}
462465
} catch (Exception e) {
463466
e.printStackTrace();
464467
}

0 commit comments

Comments
 (0)