mirror of
https://github.com/shuaiplus/nodewarden.git
synced 2026-06-20 13:00:39 +00:00
Fix attachment size handling and ensure non-null URLs for Android compatibility
This commit is contained in:
@@ -196,7 +196,7 @@ export async function handleGetAttachment(
|
|||||||
url: downloadUrl,
|
url: downloadUrl,
|
||||||
fileName: attachment.fileName,
|
fileName: attachment.fileName,
|
||||||
key: attachment.key,
|
key: attachment.key,
|
||||||
size: String(attachment.size),
|
size: Number(attachment.size) || 0,
|
||||||
sizeName: attachment.sizeName,
|
sizeName: attachment.sizeName,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -332,10 +332,10 @@ function formatCipherResponse(cipher: Cipher, attachments: Attachment[]): any {
|
|||||||
attachments: attachments.length > 0 ? attachments.map(a => ({
|
attachments: attachments.length > 0 ? attachments.map(a => ({
|
||||||
id: a.id,
|
id: a.id,
|
||||||
fileName: a.fileName,
|
fileName: a.fileName,
|
||||||
size: String(a.size),
|
size: Number(a.size) || 0,
|
||||||
sizeName: a.sizeName,
|
sizeName: a.sizeName,
|
||||||
key: a.key,
|
key: a.key,
|
||||||
url: null,
|
url: `/api/ciphers/${a.cipherId}/attachment/${a.id}`,
|
||||||
object: 'attachment',
|
object: 'attachment',
|
||||||
})) : null,
|
})) : null,
|
||||||
key: cipher.key,
|
key: cipher.key,
|
||||||
|
|||||||
@@ -10,10 +10,10 @@ function formatAttachments(attachments: Attachment[]): any[] | null {
|
|||||||
return attachments.map(a => ({
|
return attachments.map(a => ({
|
||||||
id: a.id,
|
id: a.id,
|
||||||
fileName: a.fileName,
|
fileName: a.fileName,
|
||||||
size: String(a.size),
|
size: Number(a.size) || 0, // Android expects Int, not String
|
||||||
sizeName: a.sizeName,
|
sizeName: a.sizeName,
|
||||||
key: a.key,
|
key: a.key,
|
||||||
url: null,
|
url: `/api/ciphers/${a.cipherId}/attachment/${a.id}`, // Android requires non-null url!
|
||||||
object: 'attachment',
|
object: 'attachment',
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,10 +8,10 @@ function formatAttachments(attachments: Attachment[]): any[] | null {
|
|||||||
return attachments.map(a => ({
|
return attachments.map(a => ({
|
||||||
id: a.id,
|
id: a.id,
|
||||||
fileName: a.fileName,
|
fileName: a.fileName,
|
||||||
size: String(a.size),
|
size: Number(a.size) || 0, // Android expects Int, not String
|
||||||
sizeName: a.sizeName,
|
sizeName: a.sizeName,
|
||||||
key: a.key,
|
key: a.key,
|
||||||
url: null,
|
url: `/api/ciphers/${a.cipherId}/attachment/${a.id}`, // Android requires non-null url!
|
||||||
object: 'attachment',
|
object: 'attachment',
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user