Skip to content

Node.js based forum software built for the modern web

fix: return at least one in sizeCalculation (#10832)

Opliko3975fa2e451a
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',
});