mirror of
https://github.com/1f349/dendrite.git
synced 2024-11-09 22:42:58 +00:00
mediaapi/fileutils: Comment truncation of data when reading
This commit is contained in:
parent
a4300eefc4
commit
61329ee380
@ -111,6 +111,7 @@ func WriteTempFile(reqReader io.Reader, maxFileSizeBytes types.FileSizeBytes, ab
|
||||
}
|
||||
defer tmpFile.Close()
|
||||
|
||||
// The amount of data read is limited to maxFileSizeBytes. At this point, if there is more data it will be truncated.
|
||||
limitedReader := io.LimitReader(reqReader, int64(maxFileSizeBytes))
|
||||
// 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
|
||||
|
@ -108,6 +108,7 @@ func (r *uploadRequest) doUpload(reqReader io.Reader, cfg *config.MediaAPI, db *
|
||||
// The file data is hashed and the hash is used as the MediaID. The hash is useful as a
|
||||
// method of deduplicating files to save storage, as well as a way to conduct
|
||||
// integrity checks on the file data in the repository.
|
||||
// Data is truncated to maxFileSizeBytes. Content-Length was reported as 0 < Content-Length <= maxFileSizeBytes so this is OK.
|
||||
hash, bytesWritten, tmpDir, err := fileutils.WriteTempFile(reqReader, cfg.MaxFileSizeBytes, cfg.AbsBasePath)
|
||||
if err != nil {
|
||||
r.Logger.WithError(err).WithFields(log.Fields{
|
||||
|
Loading…
Reference in New Issue
Block a user