1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-01-11 18:24:43 +02:00

Server: Fixes #6531: Fixed Unsupported File Type error when sharing certain notes

This commit is contained in:
Laurent Cozic 2022-06-14 14:58:52 +01:00
parent 176c9e0bcf
commit 0618e9ec90

View File

@ -194,7 +194,14 @@ async function renderNote(share: Share, note: NoteEntity, resourceInfos: Resourc
} else if (item.type_ === ModelType.Resource) {
return `${models_.share().shareUrl(share.owner_id, share.id)}?resource_id=${item.id}&t=${item.updated_time}`;
} else {
throw new Error(`Unsupported item type: ${item.type_}`);
// In theory, there can only be links to notes or resources. But
// in practice nothing's stopping a plugin for example to create
// a link to a folder. In this case, we don't want to throw an
// exception as that would break rendering. Instead we just
// disable the link.
// https://github.com/laurent22/joplin/issues/6531
logger.warn(`Unsupported type in share ${share.id}. Item: ${itemId}`);
return '#';
}
},