mirror of
https://github.com/Stirling-Tools/Stirling-PDF.git
synced 2025-06-06 18:30:57 +00:00
Check for null of maxUploadSize before Regex match
This commit is contained in:
parent
5f667e57c8
commit
f947130346
@ -119,18 +119,16 @@ public class AppConfig {
|
|||||||
.getUploadLimit()
|
.getUploadLimit()
|
||||||
.getEnableUploadSizeLimit()
|
.getEnableUploadSizeLimit()
|
||||||
: false;
|
: false;
|
||||||
if (!uploadLimit) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
String maxUploadSize = applicationProperties.getSystem().getUploadLimit().getLimit();
|
String maxUploadSize = applicationProperties.getSystem().getUploadLimit().getLimit();
|
||||||
if (!new Regex("^[1-9][0-9]{0,2}[K|M|G]B$").matches(maxUploadSize)) {
|
|
||||||
|
if (!uploadLimit || maxUploadSize == null || maxUploadSize.isEmpty()) {
|
||||||
|
return 0;
|
||||||
|
} else if (!new Regex("^[1-9][0-9]{0,2}[K|M|G]B$").matches(maxUploadSize)) {
|
||||||
log.error(
|
log.error(
|
||||||
"Invalid maxUploadSize format. Expected format: {1,3}[0-9][K|M|G]B, but got: {}",
|
"Invalid maxUploadSize format. Expected format: {1,3}[0-9][K|M|G]B, but got: {}",
|
||||||
maxUploadSize);
|
maxUploadSize);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
if (maxUploadSize == null || maxUploadSize.isEmpty()) {
|
|
||||||
return 0;
|
|
||||||
} else {
|
} else {
|
||||||
String unit = maxUploadSize.replaceAll("[1-9][0-9]{0,2}", "");
|
String unit = maxUploadSize.replaceAll("[1-9][0-9]{0,2}", "");
|
||||||
String number = maxUploadSize.replaceAll("[K|M|G]B", "");
|
String number = maxUploadSize.replaceAll("[K|M|G]B", "");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user