From c808a1057799ebb9e7a73bb52d7df8ff3b55f5f1 Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Fri, 5 Jun 2026 16:36:23 -0500 Subject: [PATCH] log swallowed exceptions in android share intent module The three catch blocks discarded exceptions entirely, making future diagnosis hard. Add Log.w with the exception at each catch site so unexpected failure modes (OOM on large bitmaps, truncated streams, etc.) surface in Logcat during user-reported issues, while keeping the crash-isolation behavior intact. Co-Authored-By: Claude Opus 4.8 (cherry picked from commit 4b53931468feab72da1bbb8c9af5de6bf5a97038) --- .../ExpoReceiveAndroidIntentsModule.kt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/expo-receive-android-intents/android/src/main/java/xyz/blueskyweb/app/exporeceiveandroidintents/ExpoReceiveAndroidIntentsModule.kt b/modules/expo-receive-android-intents/android/src/main/java/xyz/blueskyweb/app/exporeceiveandroidintents/ExpoReceiveAndroidIntentsModule.kt index 71400672be..2a365a1e59 100644 --- a/modules/expo-receive-android-intents/android/src/main/java/xyz/blueskyweb/app/exporeceiveandroidintents/ExpoReceiveAndroidIntentsModule.kt +++ b/modules/expo-receive-android-intents/android/src/main/java/xyz/blueskyweb/app/exporeceiveandroidintents/ExpoReceiveAndroidIntentsModule.kt @@ -6,6 +6,7 @@ import android.media.MediaMetadataRetriever import android.net.Uri import android.os.Build import android.provider.MediaStore +import android.util.Log import androidx.core.net.toUri import expo.modules.kotlin.modules.Module import expo.modules.kotlin.modules.ModuleDefinition @@ -13,6 +14,8 @@ import java.io.File import java.io.FileOutputStream import java.net.URLEncoder +private const val TAG = "ExpoReceiveAndroidIntents" + enum class AttachmentType { IMAGE, VIDEO, @@ -165,6 +168,7 @@ class ExpoReceiveAndroidIntentsModule : Module() { input.use { it.copyTo(out) } } } catch (e: Exception) { + Log.w(TAG, "Failed to copy shared video to cache", e) return } @@ -188,6 +192,7 @@ class ExpoReceiveAndroidIntentsModule : Module() { } catch (e: Exception) { // The URI may be unreadable (revoked permission, deleted file, or a // provider that rejects the read). Skip this image rather than crash. + Log.w(TAG, "Failed to read shared image", e) return null } ?: return null // We have to save this so that we can access it later when uploading the image. @@ -215,6 +220,7 @@ class ExpoReceiveAndroidIntentsModule : Module() { height = retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_HEIGHT)?.toIntOrNull() } catch (e: Exception) { // The URI may be unreadable or not a valid media source. Skip rather than crash. + Log.w(TAG, "Failed to read shared video metadata", e) return null } finally { retriever.release()