mirror of
https://github.com/cryptomator/cryptomator.git
synced 2026-05-14 08:41:28 +00:00
check first the filesize before opening a Reader to the config file
This commit is contained in:
@@ -92,11 +92,13 @@ class AdminPropertiesSetter {
|
||||
//visible for testing
|
||||
static Properties loadAdminProperties(Path adminPropertiesPath) {
|
||||
var adminProps = new Properties();
|
||||
try (var reader = Files.newBufferedReader(adminPropertiesPath, StandardCharsets.UTF_8)) {
|
||||
if(Files.size(adminPropertiesPath) > MAX_CONFIG_SIZE_BYTES) {
|
||||
try {
|
||||
if (Files.size(adminPropertiesPath) > MAX_CONFIG_SIZE_BYTES) {
|
||||
throw new IOException("Config file %s exceeds maximum size of %d".formatted(adminPropertiesPath, MAX_CONFIG_SIZE_BYTES));
|
||||
}
|
||||
adminProps.load(reader);
|
||||
try (var reader = Files.newBufferedReader(adminPropertiesPath, StandardCharsets.UTF_8)) {
|
||||
adminProps.load(reader);
|
||||
}
|
||||
} catch (NoSuchFileException _) {
|
||||
//NO-OP
|
||||
LOG.debug("No admin properties found at {}.", adminPropertiesPath);
|
||||
|
||||
Reference in New Issue
Block a user