Address review comment - universally check if temp file size exceeds max file size

This commit is contained in:
ferologics 2021-04-14 11:28:08 +02:00 committed by ferologics
parent f4d808a284
commit 3754e527a7

View file

@ -158,8 +158,8 @@ func (r *uploadRequest) doUpload(
}
}
// If Content-Length header is not set, check if temp file size exceeds max file size configuration
if r.MediaMetadata.FileSizeBytes < 1 && bytesWritten > types.FileSizeBytes(*cfg.MaxFileSizeBytes) {
// Check if temp file size exceeds max file size configuration
if bytesWritten > types.FileSizeBytes(*cfg.MaxFileSizeBytes) {
fileutils.RemoveDir(tmpDir, r.Logger) // delete temp file
return requestEntityTooLargeJSONResponse(*cfg.MaxFileSizeBytes)
}