forked from Qortal/qortal
Chunk validation now uses MAX_CHUNK_SIZE rather than CHUNK_SIZE, to allow for a smaller CHUNK_SIZE value to be optionally used, without failing the validation of existing resources.
This commit is contained in:
parent
49f466c073
commit
2630c35f8c
@ -53,6 +53,7 @@ public class ArbitraryDataFile {
|
|||||||
private static final Logger LOGGER = LogManager.getLogger(ArbitraryDataFile.class);
|
private static final Logger LOGGER = LogManager.getLogger(ArbitraryDataFile.class);
|
||||||
|
|
||||||
public static final long MAX_FILE_SIZE = 500 * 1024 * 1024; // 500MiB
|
public static final long MAX_FILE_SIZE = 500 * 1024 * 1024; // 500MiB
|
||||||
|
protected static final int MAX_CHUNK_SIZE = 1 * 1024 * 1024; // 1MiB
|
||||||
public static final int CHUNK_SIZE = 1 * 1024 * 1024; // 1MiB
|
public static final int CHUNK_SIZE = 1 * 1024 * 1024; // 1MiB
|
||||||
public static int SHORT_DIGEST_LENGTH = 8;
|
public static int SHORT_DIGEST_LENGTH = 8;
|
||||||
|
|
||||||
|
@ -40,8 +40,8 @@ public class ArbitraryDataFileChunk extends ArbitraryDataFile {
|
|||||||
try {
|
try {
|
||||||
// Validate the file size (chunks have stricter limits)
|
// Validate the file size (chunks have stricter limits)
|
||||||
long fileSize = Files.size(this.filePath);
|
long fileSize = Files.size(this.filePath);
|
||||||
if (fileSize > CHUNK_SIZE) {
|
if (fileSize > MAX_CHUNK_SIZE) {
|
||||||
LOGGER.error(String.format("DataFileChunk is too large: %d bytes (max chunk size: %d bytes)", fileSize, CHUNK_SIZE));
|
LOGGER.error(String.format("DataFileChunk is too large: %d bytes (max chunk size: %d bytes)", fileSize, MAX_CHUNK_SIZE));
|
||||||
return ValidationResult.FILE_TOO_LARGE;
|
return ValidationResult.FILE_TOO_LARGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user