Do not update applink icon if it is not set in update

This commit is contained in:
Johannes Zellner
2023-07-10 14:08:25 +02:00
parent df54ba3a0a
commit 3a5d570e3c
2 changed files with 13 additions and 8 deletions
+7
View File
@@ -185,6 +185,13 @@ async function update(applinkId, applink) {
if (applink.icon) {
if (!validator.isBase64(applink.icon)) throw new BoxError(BoxError.BAD_FIELD, 'icon is not base64');
applink.icon = Buffer.from(applink.icon, 'base64');
} else if (applink.icon === '') {
// empty string means we autodetect in detectMetaInfo
applink.icon = '';
} else {
// nothing changed reuse old
const result = await get(applinkId);
applink.icon = result.icon;
}
await detectMetaInfo(applink);