Deal with absent or incorrect ?chunk value
Pass blockSize to node.store only when correct REST ?chunk value was provided, otherwise node.store will use its default value. Also added MaxBlockSize=1 GB, so we have reasonable limit to block sizes provided by users.
This commit is contained in:
parent
967f601c2d
commit
f4e69eb109
|
@ -181,7 +181,7 @@ proc initRestApi*(node: CodexNodeRef, conf: CodexConf): RestRouter =
|
|||
|
||||
try:
|
||||
let runUpload =
|
||||
if blockSize =? chunk.get:
|
||||
if (chunkOpt =? chunk) and (blockSize =? chunkOpt) and (blockSize <= MaxBlockSize):
|
||||
node.store(bodyStream, blockSize = blockSize.int)
|
||||
else:
|
||||
node.store(bodyStream)
|
||||
|
|
Loading…
Reference in New Issue