1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-24 10:27:10 +02:00

Server: Set resource content size when viewing published note

This commit is contained in:
Laurent Cozic 2021-11-05 12:17:05 +00:00
parent 42caab6bde
commit 70d5c7a648

View File

@ -153,7 +153,7 @@ async function noteLinkedItemInfos(userId: Uuid, itemModel: ItemModel, note: Not
return output;
}
async function renderResource(userId: string, resourceId: string, item: Item, content: any): Promise<FileViewerResponse> {
async function renderResource(userId: string, resourceId: string, item: Item, content: Buffer): Promise<FileViewerResponse> {
// The item passed to this function is the resource blob, which is
// sufficient to download the resource. However, if we want a more user
// friendly download, we need to know the resource original name and mime
@ -170,7 +170,7 @@ async function renderResource(userId: string, resourceId: string, item: Item, co
return {
body: content,
mime: jopItem ? jopItem.mime : item.mime_type,
size: item.content_size,
size: content ? content.byteLength : 0,
filename: jopItem ? jopItem.title : '',
};
}