From 33290850ee8cc21f7888fd47fdcce25c5de8506f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Mon, 28 Dec 2020 12:10:48 -0500 Subject: [PATCH] fix: #9126, skip base64 and long values --- src/upgrades/1.16.0/migrate_thumbs.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/upgrades/1.16.0/migrate_thumbs.js b/src/upgrades/1.16.0/migrate_thumbs.js index b5ebd4c5cc..34851568e7 100644 --- a/src/upgrades/1.16.0/migrate_thumbs.js +++ b/src/upgrades/1.16.0/migrate_thumbs.js @@ -17,16 +17,18 @@ module.exports = { if (parseInt(current, 10) === 120) { await meta.configs.set('topicThumbSize', 512); } - await meta.configs.set('allowTopicsThumbnail', 1); await batch.processSortedSet('topics:tid', async function (tids) { const keys = tids.map(tid => `topic:${tid}`); - const topicThumbs = (await db.getObjectsFields(keys, ['thumb'])).map(obj => (obj.thumb ? obj.thumb.replace(nconf.get('upload_url'), '') : null)); + const topicThumbs = (await db.getObjectsFields(keys, ['thumb'])) + .map(obj => (obj.thumb ? obj.thumb.replace(nconf.get('upload_url'), '') : null)); await Promise.all(tids.map(async (tid, idx) => { const path = topicThumbs[idx]; if (path) { - await topics.thumbs.associate({ id: tid, path }); + if (path.length < 255 && !path.startsWith('data:')) { + await topics.thumbs.associate({ id: tid, path }); + } await db.deleteObjectField(keys[idx], 'thumb'); }