chore: bump deps

This commit is contained in:
sigoden 2023-02-21 16:39:57 +08:00
parent ad0be71557
commit 2064d7803a
4 changed files with 340 additions and 341 deletions

647
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -21,11 +21,11 @@ percent-encoding = "2.1"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
futures = "0.3"
base64 = "0.13"
async_zip = { version = "0.0.8", default-features = false, features = ["deflate"] }
base64 = "0.21"
async_zip = { version = "0.0.12", default-features = false, features = ["deflate"] }
headers = "0.3"
mime_guess = "2.0"
if-addrs = "0.7"
if-addrs = "0.8"
rustls = { version = "0.20", default-features = false, features = ["tls12"], optional = true }
rustls-pemfile = { version = "1", optional = true }
tokio-rustls = { version = "0.23", optional = true }
@ -51,7 +51,7 @@ assert_cmd = "2"
reqwest = { version = "0.11", features = ["blocking", "multipart", "rustls-tls"], default-features = false }
assert_fs = "1"
port_check = "0.1"
rstest = "0.15"
rstest = "0.16"
regex = "1"
url = "2"
diqwest = { version = "1", features = ["blocking"] }

View file

@ -1,3 +1,4 @@
use base64::{engine::general_purpose, Engine as _};
use headers::HeaderValue;
use hyper::Method;
use lazy_static::lazy_static;
@ -215,8 +216,9 @@ impl AuthMethod {
pub fn get_user(&self, authorization: &HeaderValue) -> Option<String> {
match self {
AuthMethod::Basic => {
let value: Vec<u8> =
base64::decode(strip_prefix(authorization.as_bytes(), b"Basic ")?).ok()?;
let value: Vec<u8> = general_purpose::STANDARD_NO_PAD
.decode(strip_prefix(authorization.as_bytes(), b"Basic ")?)
.ok()?;
let parts: Vec<&str> = std::str::from_utf8(&value).ok()?.split(':').collect();
Some(parts[0].to_string())
}
@ -239,8 +241,9 @@ impl AuthMethod {
) -> Option<()> {
match self {
AuthMethod::Basic => {
let basic_value: Vec<u8> =
base64::decode(strip_prefix(authorization.as_bytes(), b"Basic ")?).ok()?;
let basic_value: Vec<u8> = general_purpose::STANDARD_NO_PAD
.decode(strip_prefix(authorization.as_bytes(), b"Basic ")?)
.ok()?;
let parts: Vec<&str> = std::str::from_utf8(&basic_value).ok()?.split(':').collect();
if parts[0] != auth_user {

View file

@ -4,8 +4,8 @@ use crate::{Args, BoxResult};
use walkdir::WalkDir;
use xml::escape::escape_str_pcdata;
use async_zip::write::{EntryOptions, ZipFileWriter};
use async_zip::Compression;
use async_zip::write::ZipFileWriter;
use async_zip::{Compression, ZipEntryBuilder};
use chrono::{TimeZone, Utc};
use futures::TryStreamExt;
use headers::{
@ -1140,7 +1140,10 @@ impl PathItem {
}
pub fn to_dav_xml(&self, prefix: &str) -> String {
let mtime = Utc.timestamp_millis(self.mtime as i64).to_rfc2822();
let mtime = Utc
.timestamp_millis_opt(self.mtime as i64)
.unwrap()
.to_rfc2822();
let mut href = encode_uri(&format!("{}{}", prefix, &self.name));
if self.is_dir() && !href.ends_with('/') {
href.push('/');
@ -1305,10 +1308,10 @@ async fn zip_dir<W: AsyncWrite + Unpin>(
Some(v) => v,
None => continue,
};
let entry_options =
EntryOptions::new(filename.to_owned(), Compression::Deflate).unix_permissions(0o644);
let builder =
ZipEntryBuilder::new(filename.into(), Compression::Deflate).unix_permissions(0o644);
let mut file = File::open(&zip_path).await?;
let mut file_writer = writer.write_entry_stream(entry_options).await?;
let mut file_writer = writer.write_entry_stream(builder).await?;
io::copy(&mut file, &mut file_writer).await?;
file_writer.close().await?;
}