ACS-4633: Duplicated tag is not detected when tag string contains upper case (#1750)

This commit is contained in:
Krystian Dabrowski
2023-02-15 18:13:19 +01:00
committed by GitHub
parent 7c3e8a2549
commit 23de0fefd7
2 changed files with 17 additions and 9 deletions

View File

@@ -1586,11 +1586,11 @@ public class TaggingServiceImpl implements TaggingService,
try
{
return tagNames.stream()
.map(String::toLowerCase)
.peek(tagName -> categoryService.getRootCategories(storeRef, ContentModel.ASPECT_TAGGABLE, tagName, false).stream()
.filter(association -> Objects.nonNull(association.getChildRef()))
.findAny()
.ifPresent(association -> { throw new DuplicateChildNodeNameException(association.getParentRef(), association.getTypeQName(), tagName, null); }))
.map(String::toLowerCase)
.map(tagName -> new Pair<>(tagName, getTagNodeRef(storeRef, tagName, true)))
.collect(Collectors.toList());
}