mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-07 23:13:11 -06:00
mediaapi/writers/download: Reduce complexity of copyToActiveAndPassive
This commit is contained in:
parent
b80d5ab919
commit
5348b64edc
|
|
@ -297,7 +297,10 @@ func copyToActiveAndPassive(r io.Reader, wActive io.Writer, wPassive io.Writer,
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
bytesResponded += int64(bytesTemp)
|
bytesResponded += int64(bytesTemp)
|
||||||
if copyError == nil || (copyError != errFileIsTooLarge && copyError != errWrite) {
|
if copyError == nil {
|
||||||
|
// Note: if we get here then copyError != errFileIsTooLarge && copyError != errWrite
|
||||||
|
// as if copyError == errResponse || copyError == errWrite then we would have broken
|
||||||
|
// out of the loop and there are no other cases
|
||||||
// if larger than maxFileSize then stop writing to disk and discard cached file
|
// if larger than maxFileSize then stop writing to disk and discard cached file
|
||||||
if bytesWritten+int64(len(buffer)) > int64(maxFileSize) {
|
if bytesWritten+int64(len(buffer)) > int64(maxFileSize) {
|
||||||
copyError = errFileIsTooLarge
|
copyError = errFileIsTooLarge
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue