mirror of
https://github.com/shuaiplus/nodewarden.git
synced 2026-06-20 13:00:39 +00:00
fix: ensure attachment size is formatted as string for compatibility with Bitwarden clients
This commit is contained in:
@@ -198,7 +198,7 @@ export async function handleGetAttachment(
|
|||||||
url: downloadUrl,
|
url: downloadUrl,
|
||||||
fileName: attachment.fileName,
|
fileName: attachment.fileName,
|
||||||
key: attachment.key,
|
key: attachment.key,
|
||||||
size: Number(attachment.size) || 0,
|
size: String(Number(attachment.size) || 0),
|
||||||
sizeName: attachment.sizeName,
|
sizeName: attachment.sizeName,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,8 @@ export 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: Number(a.size) || 0, // Android expects Int, not String
|
// Bitwarden clients decode attachment size as string in cipher payloads.
|
||||||
|
size: String(Number(a.size) || 0),
|
||||||
sizeName: a.sizeName,
|
sizeName: a.sizeName,
|
||||||
key: a.key,
|
key: a.key,
|
||||||
url: `/api/ciphers/${a.cipherId}/attachment/${a.id}`, // Android requires non-null url!
|
url: `/api/ciphers/${a.cipherId}/attachment/${a.id}`, // Android requires non-null url!
|
||||||
|
|||||||
Reference in New Issue
Block a user