mirror of
https://git.asonix.dog/asonix/pict-rs.git
synced 2024-12-01 05:51:07 +00:00
Fix content range serving
This commit is contained in:
parent
356e57e53d
commit
32045d2bef
4 changed files with 7 additions and 3 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -1580,7 +1580,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "pict-rs"
|
||||
version = "0.3.0-rc.7"
|
||||
version = "0.3.0-rc.8"
|
||||
dependencies = [
|
||||
"actix-form-data",
|
||||
"actix-rt",
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
[package]
|
||||
name = "pict-rs"
|
||||
description = "A simple image hosting service"
|
||||
version = "0.3.0-rc.7"
|
||||
version = "0.3.0-rc.8"
|
||||
authors = ["asonix <asonix@asonix.dog>"]
|
||||
license = "AGPL-3.0"
|
||||
readme = "README.md"
|
||||
|
|
|
@ -9,7 +9,7 @@ _a simple image hosting service_
|
|||
## Usage
|
||||
### Running
|
||||
```
|
||||
pict-rs 0.3.0-rc.7
|
||||
pict-rs 0.3.0-rc.8
|
||||
|
||||
USAGE:
|
||||
pict-rs [FLAGS] [OPTIONS] [SUBCOMMAND]
|
||||
|
|
|
@ -15,6 +15,8 @@ pub(crate) fn chop_bytes(
|
|||
length: u64,
|
||||
) -> Result<impl Stream<Item = Result<Bytes, Error>>, Error> {
|
||||
if let Some((start, end)) = byte_range.to_satisfiable_range(length) {
|
||||
// END IS INCLUSIVE
|
||||
let end = end as usize + 1;
|
||||
return Ok(once(ready(Ok(bytes.slice(start as usize..end as usize)))));
|
||||
}
|
||||
|
||||
|
@ -31,6 +33,8 @@ where
|
|||
Error: From<S::Error>,
|
||||
{
|
||||
if let Some((start, end)) = byte_range.to_satisfiable_range(length) {
|
||||
// END IS INCLUSIVE
|
||||
let end = end + 1;
|
||||
return Ok(store
|
||||
.to_stream(identifier, Some(start), Some(end.saturating_sub(start)))
|
||||
.await?);
|
||||
|
|
Loading…
Reference in a new issue