mirror of
https://github.com/codex-storage/nim-codex.git
synced 2025-02-16 14:57:54 +00:00
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:
|
try:
|
||||||
let runUpload =
|
let runUpload =
|
||||||
if blockSize =? chunk.get:
|
if (chunkOpt =? chunk) and (blockSize =? chunkOpt) and (blockSize <= MaxBlockSize):
|
||||||
node.store(bodyStream, blockSize = blockSize.int)
|
node.store(bodyStream, blockSize = blockSize.int)
|
||||||
else:
|
else:
|
||||||
node.store(bodyStream)
|
node.store(bodyStream)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user