🐛 bug: fix content length when byte serving
parent
80f1c21fd0
commit
b642142332
|
@ -312,12 +312,12 @@ async fn stream_file (
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer.truncate (bytes_read);
|
|
||||||
|
|
||||||
let bytes_read_64 = u64::try_from (bytes_read).expect ("Couldn't fit usize into u64");
|
let bytes_read_64 = u64::try_from (bytes_read).expect ("Couldn't fit usize into u64");
|
||||||
|
|
||||||
let bytes_read_64 = min (bytes_left, bytes_read_64);
|
let bytes_read_64 = min (bytes_left, bytes_read_64);
|
||||||
|
|
||||||
|
buffer.truncate (bytes_read_64 as usize);
|
||||||
|
|
||||||
if tx.send (Ok::<_, Infallible> (buffer)).await.is_err () {
|
if tx.send (Ok::<_, Infallible> (buffer)).await.is_err () {
|
||||||
warn! ("Cancelling file stream (Sent {} out of {} bytes)", bytes_sent, content_length);
|
warn! ("Cancelling file stream (Sent {} out of {} bytes)", bytes_sent, content_length);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue