Forbid the upload of files bigger than the memory backend capacity

This commit is contained in:
Anis Elleuch
2015-05-28 19:33:35 +01:00
parent ab80057c5c
commit d360d0fec3
3 changed files with 25 additions and 8 deletions

View File

@@ -271,8 +271,11 @@ func (memory *memoryDriver) createObject(bucket, key, contentType, expectedMD5Su
totalLength := len(readBytes)
memory.lock.Lock()
memory.objects.Set(objectKey, readBytes)
ok := memory.objects.Set(objectKey, readBytes)
memory.lock.Unlock()
if !ok {
return "", iodine.New(drivers.InternalError{}, nil)
}
// setting up for de-allocation
readBytes = nil