Przeglądaj źródła

trim empty string

Shun Miyazawa 4 lat temu
rodzic
commit
c3d4c5d894

+ 2 - 4
packages/app/src/server/routes/apiv3/user-group.js

@@ -96,10 +96,8 @@ module.exports = (crowi) => {
       const { parentIdsJoinedByComma, includeGrandChildren = false } = req.query;
 
       let parentIdList = [];
-      if (parentIdsJoinedByComma != null) {
-        parentIdList = parentIdsJoinedByComma
-          .split(',')
-          .filter(parentId => parentId !== '');
+      if (parentIdsJoinedByComma != null && parentIdsJoinedByComma !== '') { // null check & trim empty string
+        parentIdList = parentIdsJoinedByComma.split(',');
       }
 
       let childUserGroups = [];