base url can be altered only if existing is null or empty

This commit is contained in:
Konstantinos Spyrou 2023-01-20 19:17:06 +02:00
parent 7b7c6b0842
commit ab03a5164d
1 changed files with 6 additions and 0 deletions

View File

@ -656,6 +656,12 @@ public class RepositoryServiceImpl implements RepositoryService {
String desiredCompatibilityLevel) throws Exception {
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
Repository repository = this.getRepositoryById(repoId);
if (repositoryInterface.getId() != null) {
RepositoryInterface existing = getRepositoryInterface(repoId).stream().filter(iFace -> iFace.getId().equals(repositoryInterface.getId())).findFirst().orElse(null);
if (existing != null && (existing.getBaseurl() == null || "".equals(existing.getBaseurl()))) {
this.updateBaseUrl(repoId, repositoryInterface.getId(), repositoryInterface.getBaseurl());
}
}
this.updateValidationSet(repoId, repositoryInterface.getId(), repositoryInterface.getAccessSet());