diff options
author | Neil Alexander <neilalexander@users.noreply.github.com> | 2020-08-28 09:46:32 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-28 09:46:32 +0100 |
commit | fee1c227905530c9a941cc83425de69dec4c25ba (patch) | |
tree | 8e2467ca1edffc9499f31e4b7af69d515fed93d8 /mediaapi | |
parent | 9af2f5f1f253a821cec660ef477c274d5cd13953 (diff) |
Fix #1361 (#1362)
Diffstat (limited to 'mediaapi')
-rw-r--r-- | mediaapi/fileutils/fileutils.go | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/mediaapi/fileutils/fileutils.go b/mediaapi/fileutils/fileutils.go index 5650efdb..92ce6400 100644 --- a/mediaapi/fileutils/fileutils.go +++ b/mediaapi/fileutils/fileutils.go @@ -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. - limitedReader := io.LimitReader(reqReader, int64(maxFileSizeBytes)) + // If the max_file_size_bytes configuration option is set to a positive + // 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 // method of deduplicating files to save storage, as well as a way to conduct // integrity checks on the file data in the repository. |