You've already forked AstralRinth
forked from didirus/AstralRinth
Version updates (#3626)
* Update some Labrinth dependencies * Update some Labrinth dependencies * Update some Labrinth dependencies * Update zip in Labrinth * Update itertools in Labrinth * Update validator in labrinth * Update thiserror in labrinth * Update rust_decimal, redis, and deadpool-redis in labrinth * Update totp-rs and spdx in labrinth * Update maxminddb and tar in labrinth * Update sentry and sentry-actix in labrinth * Update image in labrinth * Update lettre in labrinth * Update derive-new and rust_iso3166 in labrinth * Update async-stripe and json-patch in labrinth * Update clap and iana-time-zone in labrinth * Update labrinth to Rust 2024 * Cargo fmt * Just do a full cargo update * Update daedelus to Rust 2024 * Update daedelus_client to Rust 2024 * Set the formatting edition to 2024 * Fix formatting IntelliJ messed up my formatting
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
use super::authorization::UploadUrlData;
|
||||
use crate::file_hosting::FileHostingError;
|
||||
use bytes::Bytes;
|
||||
use hex::ToHex;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use sha1::Digest;
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
@@ -35,7 +37,7 @@ pub async fn upload_file(
|
||||
.header(reqwest::header::CONTENT_LENGTH, file_bytes.len())
|
||||
.header(
|
||||
"X-Bz-Content-Sha1",
|
||||
sha1::Sha1::from(&file_bytes).hexdigest(),
|
||||
sha1::Sha1::digest(&file_bytes).encode_hex::<String>(),
|
||||
)
|
||||
.body(file_bytes)
|
||||
.send()
|
||||
|
||||
@@ -2,6 +2,7 @@ use super::{DeleteFileData, FileHost, FileHostingError, UploadFileData};
|
||||
use async_trait::async_trait;
|
||||
use bytes::Bytes;
|
||||
use chrono::Utc;
|
||||
use hex::ToHex;
|
||||
use sha2::Digest;
|
||||
|
||||
#[derive(Default)]
|
||||
@@ -27,7 +28,7 @@ impl FileHost for MockHost {
|
||||
std::fs::create_dir_all(
|
||||
path.parent().ok_or(FileHostingError::InvalidFilename)?,
|
||||
)?;
|
||||
let content_sha1 = sha1::Sha1::from(&file_bytes).hexdigest();
|
||||
let content_sha1 = sha1::Sha1::digest(&file_bytes).encode_hex();
|
||||
let content_sha512 = format!("{:x}", sha2::Sha512::digest(&file_bytes));
|
||||
|
||||
std::fs::write(path, &*file_bytes)?;
|
||||
|
||||
@@ -4,6 +4,7 @@ use crate::file_hosting::{
|
||||
use async_trait::async_trait;
|
||||
use bytes::Bytes;
|
||||
use chrono::Utc;
|
||||
use hex::ToHex;
|
||||
use s3::bucket::Bucket;
|
||||
use s3::creds::Credentials;
|
||||
use s3::region::Region;
|
||||
@@ -52,7 +53,7 @@ impl S3Host {
|
||||
)
|
||||
})?;
|
||||
|
||||
Ok(S3Host { bucket })
|
||||
Ok(S3Host { bucket: *bucket })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,7 +65,7 @@ impl FileHost for S3Host {
|
||||
file_name: &str,
|
||||
file_bytes: Bytes,
|
||||
) -> Result<UploadFileData, FileHostingError> {
|
||||
let content_sha1 = sha1::Sha1::from(&file_bytes).hexdigest();
|
||||
let content_sha1 = sha1::Sha1::digest(&file_bytes).encode_hex();
|
||||
let content_sha512 = format!("{:x}", sha2::Sha512::digest(&file_bytes));
|
||||
|
||||
self.bucket
|
||||
|
||||
Reference in New Issue
Block a user