Fix potential crash when saving to fallback attachment folder.

Fixes #14720
This commit is contained in:
Greyson Parrelli
2026-04-13 16:52:35 -04:00
committed by jeffrey-signal
parent 7e4736969c
commit eded335766

View File

@@ -216,6 +216,9 @@ object SaveAttachmentUtil {
} catch (e: RuntimeException) {
if (e is IllegalArgumentException || e.cause is IllegalArgumentException) {
Log.w(TAG, "Unable to create uri in $outputUri with mimeType [$mimeType]")
if (Build.VERSION.SDK_INT > 28) {
contentValues.put(MediaStore.MediaColumns.RELATIVE_PATH, Environment.DIRECTORY_DOWNLOADS + "/Signal")
}
CreateMediaUriResult(StorageUtil.getDownloadUri(), AppDependencies.application.contentResolver.insert(StorageUtil.getDownloadUri(), contentValues))
} else {
throw e