Skip to content

Commit 020c2b3

Browse files
committed
Fix handling of value that overflows an int
Closes gh-38146
1 parent 747291c commit 020c2b3

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/ReactiveMultipartAutoConfiguration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ CodecCustomizer defaultPartHttpMessageReaderCustomizer(ReactiveMultipartProperti
6262
.asInt(DataSize::toBytes)
6363
.to(defaultPartHttpMessageReader::setMaxHeadersSize);
6464
map.from(multipartProperties::getMaxDiskUsagePerPart)
65-
.asInt(DataSize::toBytes)
65+
.as(DataSize::toBytes)
6666
.to(defaultPartHttpMessageReader::setMaxDiskUsagePerPart);
6767
map.from(multipartProperties::getMaxParts).to(defaultPartHttpMessageReader::setMaxParts);
6868
map.from(multipartProperties::getStreaming).to(defaultPartHttpMessageReader::setStreaming);

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/reactive/ReactiveMultipartAutoConfigurationTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ void shouldConfigureMultipartProperties() {
6060
this.contextRunner
6161
.withPropertyValues("spring.webflux.multipart.streaming:true",
6262
"spring.webflux.multipart.max-in-memory-size=1GB", "spring.webflux.multipart.max-headers-size=16KB",
63-
"spring.webflux.multipart.max-disk-usage-per-part=100MB", "spring.webflux.multipart.max-parts=7",
63+
"spring.webflux.multipart.max-disk-usage-per-part=3GB", "spring.webflux.multipart.max-parts=7",
6464
"spring.webflux.multipart.headers-charset:UTF_16")
6565
.run((context) -> {
6666
CodecCustomizer customizer = context.getBean(CodecCustomizer.class);
@@ -75,7 +75,7 @@ void shouldConfigureMultipartProperties() {
7575
assertThat(partReader).hasFieldOrPropertyWithValue("maxInMemorySize",
7676
Math.toIntExact(DataSize.ofGigabytes(1).toBytes()));
7777
assertThat(partReader).hasFieldOrPropertyWithValue("maxDiskUsagePerPart",
78-
DataSize.ofMegabytes(100).toBytes());
78+
DataSize.ofGigabytes(3).toBytes());
7979
});
8080
}
8181

0 commit comments

Comments
 (0)