From a17a29f5d83a768876069b634fc8662bb41d1c83 Mon Sep 17 00:00:00 2001 From: AL-Session <160798022+AL-Session@users.noreply.github.com> Date: Tue, 21 Jan 2025 16:51:14 +1100 Subject: [PATCH] Done (#890) Co-authored-by: alansley --- .../libsession/messaging/messages/visible/Attachment.kt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/libsession/src/main/java/org/session/libsession/messaging/messages/visible/Attachment.kt b/libsession/src/main/java/org/session/libsession/messaging/messages/visible/Attachment.kt index 032e0a9dbe..4dade6e40d 100644 --- a/libsession/src/main/java/org/session/libsession/messaging/messages/visible/Attachment.kt +++ b/libsession/src/main/java/org/session/libsession/messaging/messages/visible/Attachment.kt @@ -75,9 +75,12 @@ class Attachment { .setDigest(ByteString.copyFrom(attachment.digest.get())) .setSize(attachment.size.get()) .setUrl(attachment.url) - - // Filenames are now mandatory - builder.fileName = attachment.filename + + // Filenames are now mandatory for picked/shared files, Giphy GIFs, and captured photos. + // The images associated with LinkPreviews don't have a "given name" so we'll use the + // attachment ID as the filename. It's not possible to save these preview images or see + // the filename, so what the filename IS isn't important, only that a filename exists. + builder.fileName = attachment.filename ?: attachment.id.toString() if (attachment.preview.isPresent) { builder.thumbnail = ByteString.copyFrom(attachment.preview.get()) } if (attachment.width > 0) { builder.width = attachment.width }