mirror of
https://github.com/matrix-org/dendrite.git
synced 2024-11-22 22:31:56 -06:00
✂️ Media API: Handle unlimited file size (#1881)
This commit is contained in:
parent
5357df36c9
commit
79181f2348
|
@ -685,7 +685,7 @@ func (r *downloadRequest) GetContentLengthAndReader(contentLengthHeader string,
|
||||||
r.Logger.WithError(parseErr).Warn("Failed to parse content length")
|
r.Logger.WithError(parseErr).Warn("Failed to parse content length")
|
||||||
return 0, nil, fmt.Errorf("strconv.ParseInt: %w", parseErr)
|
return 0, nil, fmt.Errorf("strconv.ParseInt: %w", parseErr)
|
||||||
}
|
}
|
||||||
if parsedLength > int64(maxFileSizeBytes) {
|
if maxFileSizeBytes > 0 && parsedLength > int64(maxFileSizeBytes) {
|
||||||
return 0, nil, fmt.Errorf(
|
return 0, nil, fmt.Errorf(
|
||||||
"remote file size (%d bytes) exceeds locally configured max media size (%d bytes)",
|
"remote file size (%d bytes) exceeds locally configured max media size (%d bytes)",
|
||||||
parsedLength, maxFileSizeBytes,
|
parsedLength, maxFileSizeBytes,
|
||||||
|
|
Loading…
Reference in a new issue