Skip to content

Commit

Permalink
remove duplicates from item insertion #EA-3957
Browse files Browse the repository at this point in the history
  • Loading branch information
gsergiu committed Nov 28, 2024
1 parent 3663ccb commit 0d0b3f9
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -551,17 +551,17 @@ protected List<String> validateItemsStrings(List<String> items) throws ItemValid
}

List<String> invalidItems = new ArrayList<>();
String fullUrl;
for(String item : items) {
try {
validateItem(item);
if(item.startsWith(getConfiguration().getItemDataEndpoint())) {
itemsWithFullUrls.add(item);
} else {
//convert to full URL
itemsWithFullUrls.add(
UserSetUtils.buildItemUrl(getConfiguration().getItemDataEndpoint(), item));
//convert to fullUrl if needed
fullUrl = (item.startsWith(getConfiguration().getItemDataEndpoint())) ?
item : UserSetUtils.buildItemUrl(getConfiguration().getItemDataEndpoint(), item);
//do not include duplicates
if(!itemsWithFullUrls.contains(fullUrl)) {
itemsWithFullUrls.add(fullUrl);
}

} catch (ItemValidationException ex) {
logger.trace("Invalid item: {}", item);
invalidItems.add(item);
Expand Down

0 comments on commit 0d0b3f9

Please sign in to comment.