Skip to content

Commit 681df4f

Browse files
committed
fix: make MultipartProperties nullable in HandshakeController
- Fix test compatibility issue by making MultipartProperties parameter optional - Add null check to prevent NullPointerException in test environments - Ensure file size limit feature works when MultipartProperties is available Signed-off-by: spursjiang <949474720@qq.com>
1 parent bebc0ad commit 681df4f

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

server/src/main/java/org/eclipse/jifa/server/controller/HandshakeController.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public class HandshakeController extends ConfigurationAccessor {
4848
public HandshakeController(CipherService cipherService,
4949
UserService userService,
5050
@Nullable OAuth2ClientProperties oauth2ClientProperties,
51-
MultipartProperties multipartProperties) {
51+
@Nullable MultipartProperties multipartProperties) {
5252
this.cipherService = cipherService;
5353
this.userService = userService;
5454
this.multipartProperties = multipartProperties;
@@ -69,8 +69,11 @@ public HandshakeResponse handshake() {
6969
User user = userEntity == null ? null : new User(userEntity.getName(), userEntity.isAdmin());
7070

7171
// Get file size limit configuration
72-
DataSize maxFileSize = multipartProperties.getMaxFileSize();
73-
long maxFileSizeBytes = maxFileSize.toBytes();
72+
long maxFileSizeBytes = 0;
73+
if (multipartProperties != null) {
74+
DataSize maxFileSize = multipartProperties.getMaxFileSize();
75+
maxFileSizeBytes = maxFileSize.toBytes();
76+
}
7477

7578
return new HandshakeResponse(getRole(),
7679
config.isAllowLogin(),

0 commit comments

Comments
 (0)