This commit is contained in:
Stefan Hardegger
2025-07-24 13:07:36 +02:00
parent 90428894b4
commit 131e2e8c25
3 changed files with 134 additions and 32 deletions

View File

@@ -15,6 +15,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.UUID;
@@ -339,8 +340,10 @@ public class AuthorService {
existing.setAuthorRating(updates.getAuthorRating());
}
if (updates.getUrls() != null) {
// Create a defensive copy to avoid issues when existing and updates are the same object
List<String> urlsCopy = new ArrayList<>(updates.getUrls());
existing.getUrls().clear();
existing.getUrls().addAll(updates.getUrls());
existing.getUrls().addAll(urlsCopy);
}
}
}