mirror of
https://github.com/matrix-org/dendrite.git
synced 2024-11-26 00:01:55 -06:00
parent
9af2f5f1f2
commit
fee1c22790
|
@ -124,8 +124,13 @@ func WriteTempFile(
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
// The amount of data read is limited to maxFileSizeBytes. At this point, if there is more data it will be truncated.
|
// If the max_file_size_bytes configuration option is set to a positive
|
||||||
limitedReader := io.LimitReader(reqReader, int64(maxFileSizeBytes))
|
// number then limit the upload to that size. Otherwise, just read the
|
||||||
|
// whole file.
|
||||||
|
limitedReader := reqReader
|
||||||
|
if maxFileSizeBytes > 0 {
|
||||||
|
limitedReader = io.LimitReader(reqReader, int64(maxFileSizeBytes))
|
||||||
|
}
|
||||||
// Hash the file data. The hash will be returned. The hash is useful as a
|
// Hash the file data. The hash will be returned. The hash is useful as a
|
||||||
// method of deduplicating files to save storage, as well as a way to conduct
|
// method of deduplicating files to save storage, as well as a way to conduct
|
||||||
// integrity checks on the file data in the repository.
|
// integrity checks on the file data in the repository.
|
||||||
|
|
Loading…
Reference in a new issue