Fix attachment size handling and ensure non-null URLs for Android compatibility

This commit is contained in:
shuaiplus
2026-02-07 04:31:16 +08:00
parent ec9d3b889d
commit c2fc9c47c6
3 changed files with 7 additions and 7 deletions
+3 -3
View File
@@ -196,7 +196,7 @@ export async function handleGetAttachment(
url: downloadUrl,
fileName: attachment.fileName,
key: attachment.key,
size: String(attachment.size),
size: Number(attachment.size) || 0,
sizeName: attachment.sizeName,
});
}
@@ -332,10 +332,10 @@ function formatCipherResponse(cipher: Cipher, attachments: Attachment[]): any {
attachments: attachments.length > 0 ? attachments.map(a => ({
id: a.id,
fileName: a.fileName,
size: String(a.size),
size: Number(a.size) || 0,
sizeName: a.sizeName,
key: a.key,
url: null,
url: `/api/ciphers/${a.cipherId}/attachment/${a.id}`,
object: 'attachment',
})) : null,
key: cipher.key,
+2 -2
View File
@@ -10,10 +10,10 @@ function formatAttachments(attachments: Attachment[]): any[] | null {
return attachments.map(a => ({
id: a.id,
fileName: a.fileName,
size: String(a.size),
size: Number(a.size) || 0, // Android expects Int, not String
sizeName: a.sizeName,
key: a.key,
url: null,
url: `/api/ciphers/${a.cipherId}/attachment/${a.id}`, // Android requires non-null url!
object: 'attachment',
}));
}
+2 -2
View File
@@ -8,10 +8,10 @@ function formatAttachments(attachments: Attachment[]): any[] | null {
return attachments.map(a => ({
id: a.id,
fileName: a.fileName,
size: String(a.size),
size: Number(a.size) || 0, // Android expects Int, not String
sizeName: a.sizeName,
key: a.key,
url: null,
url: `/api/ciphers/${a.cipherId}/attachment/${a.id}`, // Android requires non-null url!
object: 'attachment',
}));
}