17
17
import org .springframework .web .reactive .function .BodyInserters ;
18
18
import reactor .core .publisher .Mono ;
19
19
20
+ import java .util .ArrayList ;
20
21
import java .util .Map ;
22
+ import java .util .Objects ;
21
23
22
24
@ RequiredArgsConstructor
23
25
@ RestController
@@ -48,7 +50,7 @@ private Mono<ResponseEntity<Resource>> forwardToNodeService(String applicationId
48
50
String withoutLeadingSlash = path .startsWith ("/" ) ? path .substring (1 ) : path ;
49
51
if (applicationId .equals ("none" )) {
50
52
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 ());
52
54
return WebClientBuildHelper .builder ()
53
55
.systemProxy ()
54
56
.build ()
@@ -66,7 +68,7 @@ private Mono<ResponseEntity<Resource>> forwardToNodeService(String applicationId
66
68
}));
67
69
} else {
68
70
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 ());
70
72
return WebClientBuildHelper .builder ()
71
73
.systemProxy ()
72
74
.build ()
0 commit comments