Skip to content

Node.js based forum software built for the modern web

fix: prevent infinite loops if category is already in children

Barış Soner Uşaklıb71e0eb17987
diff --git a/src/categories/index.js b/src/categories/index.js
index a1275481e8..76a16878d4 100644
--- a/src/categories/index.js
+++ b/src/categories/index.js
@@ -345,7 +345,7 @@ Categories.getChildrenCids = function (rootCid, callback) {
if (err) {
return callback(err);
}
-
+ childrenCids = childrenCids.filter(cid => !allCids.includes(parseInt(cid, 10)));
if (!childrenCids.length) {
return callback();
}