mirror of
https://git.asonix.dog/asonix/pict-rs
synced 2024-12-24 18:03:37 +00:00
Aggregate bytes list into single bytes for object storage
This is a workaround for reqwest overriding the content-length header
This commit is contained in:
parent
cedc32d942
commit
a30b1ae540
5 changed files with 10 additions and 6 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -1621,7 +1621,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "pict-rs"
|
||||
version = "0.4.2-rc.1"
|
||||
version = "0.4.2-rc.2"
|
||||
dependencies = [
|
||||
"actix-form-data",
|
||||
"actix-rt",
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
[package]
|
||||
name = "pict-rs"
|
||||
description = "A simple image hosting service"
|
||||
version = "0.4.2-rc.1"
|
||||
version = "0.4.2-rc.2"
|
||||
authors = ["asonix <asonix@asonix.dog>"]
|
||||
license = "AGPL-3.0"
|
||||
readme = "README.md"
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
rustPlatform.buildRustPackage {
|
||||
pname = "pict-rs";
|
||||
version = "0.4.2-rc.1";
|
||||
version = "0.4.2-rc.2";
|
||||
src = ./.;
|
||||
|
||||
cargoLock = {
|
||||
|
|
|
@ -84,4 +84,8 @@ impl futures_util::Stream for BytesStream {
|
|||
fn poll_next(self: Pin<&mut Self>, _: &mut Context<'_>) -> Poll<Option<Self::Item>> {
|
||||
Poll::Ready(self.get_mut().inner.pop_front().map(Ok))
|
||||
}
|
||||
|
||||
fn size_hint(&self) -> (usize, Option<usize>) {
|
||||
(self.inner.len(), Some(self.inner.len()))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ use actix_web::{
|
|||
};
|
||||
use base64::{prelude::BASE64_STANDARD, Engine};
|
||||
use futures_util::{Stream, StreamExt, TryStreamExt};
|
||||
use reqwest::{header::RANGE, Body, Response};
|
||||
use reqwest::{header::RANGE, Response};
|
||||
use reqwest_middleware::{ClientWithMiddleware, RequestBuilder};
|
||||
use rusty_s3::{actions::S3Action, Bucket, BucketError, Credentials, UrlStyle};
|
||||
use std::{pin::Pin, string::FromUtf8Error, time::Duration};
|
||||
|
@ -209,7 +209,7 @@ impl Store for ObjectStore {
|
|||
drop(stream);
|
||||
let (req, object_id) = self.put_object_request(content_type).await?;
|
||||
let response = req
|
||||
.body(Body::wrap_stream(first_chunk))
|
||||
.body(first_chunk.into_bytes())
|
||||
.send()
|
||||
.await
|
||||
.map_err(ObjectError::from)?;
|
||||
|
@ -266,7 +266,7 @@ impl Store for ObjectStore {
|
|||
&upload_id2,
|
||||
)
|
||||
.await?
|
||||
.body(Body::wrap_stream(buf))
|
||||
.body(buf.into_bytes())
|
||||
.send()
|
||||
.await
|
||||
.map_err(ObjectError::from)?;
|
||||
|
|
Loading…
Reference in a new issue