fix(tag): resolve case-colliding tag names without throwing (#730) #733

Merged
marcel merged 5 commits from fix/issue-730-tag-case-collision into main 2026-06-06 11:38:47 +02:00
Showing only changes of commit 80f6468d52 - Show all commits

View File

@@ -68,7 +68,7 @@ public class TagService {
if (exact.isPresent()) return exact.get(); // exact-case wins (edit round-trip replays the stored name)
List<Tag> caseInsensitive = tagRepository.findAllByNameIgnoreCase(cleanName);
if (!caseInsensitive.isEmpty()) {
return caseInsensitive.stream().min(Comparator.comparing(Tag::getId)).get(); // deterministic tie-break by id — never throw
return caseInsensitive.stream().min(Comparator.comparing(Tag::getId)).orElseThrow(); // deterministic tie-break by id — list is non-empty, never throws
}
return tagRepository.save(Tag.builder().name(cleanName).build()); // create-when-absent (orphan tag: null sourceRef/parentId)
}