mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-27 09:06:15 +01:00
fix: #9126, skip base64 and long values
This commit is contained in:
@@ -17,16 +17,18 @@ module.exports = {
|
|||||||
if (parseInt(current, 10) === 120) {
|
if (parseInt(current, 10) === 120) {
|
||||||
await meta.configs.set('topicThumbSize', 512);
|
await meta.configs.set('topicThumbSize', 512);
|
||||||
}
|
}
|
||||||
await meta.configs.set('allowTopicsThumbnail', 1);
|
|
||||||
|
|
||||||
await batch.processSortedSet('topics:tid', async function (tids) {
|
await batch.processSortedSet('topics:tid', async function (tids) {
|
||||||
const keys = tids.map(tid => `topic:${tid}`);
|
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) => {
|
await Promise.all(tids.map(async (tid, idx) => {
|
||||||
const path = topicThumbs[idx];
|
const path = topicThumbs[idx];
|
||||||
if (path) {
|
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');
|
await db.deleteObjectField(keys[idx], 'thumb');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user