From dd2be223518ca010249c6e47bc0b3e858738b181 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Tue, 26 Feb 2019 16:45:26 -0500 Subject: [PATCH] trim slashes --- src/services/collection.service.ts | 4 ++-- src/services/folder.service.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/services/collection.service.ts b/src/services/collection.service.ts index ef7d602c8e..842f5614cb 100644 --- a/src/services/collection.service.ts +++ b/src/services/collection.service.ts @@ -107,8 +107,8 @@ export class CollectionService implements CollectionServiceAbstraction { const collectionCopy = new CollectionView(); collectionCopy.id = c.id; collectionCopy.organizationId = c.organizationId; - ServiceUtils.nestedTraverse(nodes, 0, c.name.split(NestingDelimiter), collectionCopy, - null, NestingDelimiter); + ServiceUtils.nestedTraverse(nodes, 0, c.name.replace(/^\/+|\/+$/g, '').split(NestingDelimiter), + collectionCopy, null, NestingDelimiter); }); return nodes; } diff --git a/src/services/folder.service.ts b/src/services/folder.service.ts index 70fc7f1e71..ba64f0e53a 100644 --- a/src/services/folder.service.ts +++ b/src/services/folder.service.ts @@ -105,8 +105,8 @@ export class FolderService implements FolderServiceAbstraction { const folderCopy = new FolderView(); folderCopy.id = f.id; folderCopy.revisionDate = f.revisionDate; - ServiceUtils.nestedTraverse(nodes, 0, f.name.split(NestingDelimiter), folderCopy, - null, NestingDelimiter); + ServiceUtils.nestedTraverse(nodes, 0, f.name.replace(/^\/+|\/+$/g, '').split(NestingDelimiter), + folderCopy, null, NestingDelimiter); }); return nodes; }