mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-26 08:13:09 -06:00
Address review comment - universally check if temp file size exceeds max file size
This commit is contained in:
parent
f4d808a284
commit
3754e527a7
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue