Skip to content

Commit

Permalink
Server: Set resource content size when viewing published note
Browse files Browse the repository at this point in the history
  • Loading branch information
laurent22 committed Nov 7, 2021
1 parent 42caab6 commit 70d5c7a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/server/src/utils/joplinUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 : '',
};
}
Expand Down

0 comments on commit 70d5c7a

Please sign in to comment.