From 15ca460c8f144c3167249b135902ac59289ca2f8 Mon Sep 17 00:00:00 2001 From: Opliko Date: Sat, 13 Aug 2022 15:29:56 +0200 Subject: [PATCH] fix: return at least one in sizeCalculation (#10832) if post content is empty post cache should still consider its size to be at least one. fixes #10831 --- src/posts/cache.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/posts/cache.js b/src/posts/cache.js index 888fba6424..7f4711d0cd 100644 --- a/src/posts/cache.js +++ b/src/posts/cache.js @@ -6,7 +6,7 @@ const meta = require('../meta'); module.exports = cacheCreate({ name: 'post', maxSize: meta.config.postCacheSize, - sizeCalculation: function (n) { return n.length; }, + sizeCalculation: function (n) { return n.length || 1; }, ttl: 0, enabled: global.env === 'production', });