Skip to content

Commit 5dbcd8d

Browse files
authoredOct 10, 2024
Merge pull request #1239 from lowcoder-org/feature-private-repo
fix null registry settings
2 parents 31f1cac + 28cb379 commit 5dbcd8d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed
 

‎server/api-service/lowcoder-server/src/main/java/org/lowcoder/api/npm/PrivateNpmRegistryController.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@
1717
import org.springframework.web.reactive.function.BodyInserters;
1818
import reactor.core.publisher.Mono;
1919

20+
import java.util.ArrayList;
2021
import java.util.Map;
22+
import java.util.Objects;
2123

2224
@RequiredArgsConstructor
2325
@RestController
@@ -48,7 +50,7 @@ private Mono<ResponseEntity<Resource>> forwardToNodeService(String applicationId
4850
String withoutLeadingSlash = path.startsWith("/") ? path.substring(1) : path;
4951
if(applicationId.equals("none")) {
5052
return sessionUserService.getVisitorOrgMemberCache().flatMap(orgMember -> organizationService.getOrgCommonSettings(orgMember.getOrgId()).flatMap(organizationCommonSettings -> {
51-
Map<String, Object> config = Map.of("npmRegistries", organizationCommonSettings.get("npmRegistries"), "workspaceId", orgMember.getOrgId());
53+
Map<String, Object> config = Map.of("npmRegistries", Objects.requireNonNullElse(organizationCommonSettings.get("npmRegistries"), new ArrayList<>(0)), "workspaceId", orgMember.getOrgId());
5254
return WebClientBuildHelper.builder()
5355
.systemProxy()
5456
.build()
@@ -66,7 +68,7 @@ private Mono<ResponseEntity<Resource>> forwardToNodeService(String applicationId
6668
}));
6769
} else{
6870
return applicationServiceImpl.findById(applicationId).flatMap(application -> organizationService.getById(application.getOrganizationId())).flatMap(orgMember -> organizationService.getOrgCommonSettings(orgMember.getId()).flatMap(organizationCommonSettings -> {
69-
Map<String, Object> config = Map.of("npmRegistries", organizationCommonSettings.get("npmRegistries"), "workspaceId", orgMember.getId());
71+
Map<String, Object> config = Map.of("npmRegistries", Objects.requireNonNullElse(organizationCommonSettings.get("npmRegistries"), new ArrayList<>(0)), "workspaceId", orgMember.getId());
7072
return WebClientBuildHelper.builder()
7173
.systemProxy()
7274
.build()

0 commit comments

Comments
 (0)