Skip to content

Commit

Permalink
fix ci
Browse files Browse the repository at this point in the history
  • Loading branch information
YanHeDoki committed Dec 4, 2024
1 parent 250888a commit 55c5f52
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
1 change: 1 addition & 0 deletions axum-extra/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ allowed = [
"prost",
"serde",
"tokio",
"tokio_util",
"tower_layer",
"tower_service",
]
7 changes: 3 additions & 4 deletions axum-extra/src/response/file_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,14 +162,14 @@ where

resp = resp.header(
header::CONTENT_RANGE,
format!("bytes {}-{}/{}", start, end, total_size),
format!("bytes {start}-{end}/{total_size}"),
);

resp.body(body::Body::from_stream(self.stream))
.unwrap_or_else(|e| {
(
StatusCode::INTERNAL_SERVER_ERROR,
format!("build FileStream responsec error: {}", e),
format!("build FileStream responsec error: {e}"),
)
.into_response()
})
Expand Down Expand Up @@ -240,7 +240,6 @@ where
// get file stream and seek to start to return range response
file.seek(std::io::SeekFrom::Start(start)).await?;

// lenght = end - start + 1 exmple: 0-10 = 11 bytes
let stream = ReaderStream::new(file.take(end - start + 1));

Ok(FileStream::new(stream).into_range_response(start, end, total_size))
Expand All @@ -260,7 +259,7 @@ where
if let Some(file_name) = self.file_name {
resp = resp.header(
header::CONTENT_DISPOSITION,
format!("attachment; filename=\"{}\"", file_name),
format!("attachment; filename=\"{file_name}\""),
);
}

Expand Down

0 comments on commit 55c5f52

Please sign in to comment.