Skip to content

Commit

Permalink
fix: http range header is not correct (#1004)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrislearn authored Dec 12, 2024
1 parent 7a9d645 commit 5b9acfc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion crates/core/src/fs/named_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ impl NamedFile {

if offset != 0 || length != self.metadata.len() || range.is_some() {
res.status_code(StatusCode::PARTIAL_CONTENT);
match ContentRange::bytes(offset..offset + length - 1, self.metadata.len()) {
match ContentRange::bytes(offset..offset + length, self.metadata.len()) {
Ok(content_range) => {
res.headers_mut().typed_insert(content_range);
}
Expand Down
2 changes: 1 addition & 1 deletion crates/core/src/writing/seek.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ where

if offset != 0 || length != self.length || range.is_some() {
res.status_code(StatusCode::PARTIAL_CONTENT);
match ContentRange::bytes(offset..offset + length - 1, self.length) {
match ContentRange::bytes(offset..offset + length, self.length) {
Ok(content_range) => {
res.headers_mut().typed_insert(content_range);
}
Expand Down

0 comments on commit 5b9acfc

Please sign in to comment.