fix linter issues
This commit is contained in:
parent
50098edc81
commit
98e4e96073
5 changed files with 8 additions and 6 deletions
|
|
@ -15,6 +15,7 @@ use super::{FileTrait, Uploading};
|
||||||
/// - impl `serde` for cachefile handling
|
/// - impl `serde` for cachefile handling
|
||||||
/// - impl `PartialEq..Ord` to handle multiple files given
|
/// - impl `PartialEq..Ord` to handle multiple files given
|
||||||
/// - impl `AsRef<[u8]>` for hashing with `blake2b_simd`
|
/// - impl `AsRef<[u8]>` for hashing with `blake2b_simd`
|
||||||
|
#[allow(clippy::unsafe_derive_deserialize)]
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)]
|
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)]
|
||||||
pub struct Checked {
|
pub struct Checked {
|
||||||
/// canonical path to a regular file
|
/// canonical path to a regular file
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ use super::{Checked, Chunk, FileTrait};
|
||||||
/// Description of a `file::Checked` that is actively being uploaded
|
/// Description of a `file::Checked` that is actively being uploaded
|
||||||
///
|
///
|
||||||
/// - impl `serde` for cachefile handling
|
/// - impl `serde` for cachefile handling
|
||||||
|
#[allow(clippy::unsafe_derive_deserialize)]
|
||||||
#[derive(Serialize, Deserialize, Debug)]
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
pub struct Uploading {
|
pub struct Uploading {
|
||||||
/// canonical path to a regular file
|
/// canonical path to a regular file
|
||||||
|
|
@ -217,7 +218,7 @@ mod tests {
|
||||||
} else {
|
} else {
|
||||||
assert!(eof.is_err());
|
assert!(eof.is_err());
|
||||||
assert_eq!(eof.unwrap_err(), path);
|
assert_eq!(eof.unwrap_err(), path);
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -227,7 +228,7 @@ mod tests {
|
||||||
let (mut upl, _share_id, _file) = create_uploading(content);
|
let (mut upl, _share_id, _file) = create_uploading(content);
|
||||||
|
|
||||||
// use oversized buffer
|
// use oversized buffer
|
||||||
let mut buf = vec![0; (size + extra) as usize];
|
let mut buf = vec![0; usize::try_from(size + extra).unwrap()];
|
||||||
let chunk_res = upl.read(&mut buf);
|
let chunk_res = upl.read(&mut buf);
|
||||||
|
|
||||||
if size > 0 {
|
if size > 0 {
|
||||||
|
|
@ -241,7 +242,7 @@ mod tests {
|
||||||
assert_eq!(chunk.get_data(), content);
|
assert_eq!(chunk.get_data(), content);
|
||||||
} else {
|
} else {
|
||||||
assert!(chunk_res.is_err());
|
assert!(chunk_res.is_err());
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ use log::{info, warn};
|
||||||
|
|
||||||
type StaticStyled<'t> = LazyLock<StyledObject<&'t str>>;
|
type StaticStyled<'t> = LazyLock<StyledObject<&'t str>>;
|
||||||
|
|
||||||
pub const SHRUPL: StaticStyled = LazyLock::new(|| style("ShrUpl").yellow().bold());
|
pub static SHRUPL: StaticStyled = LazyLock::new(|| style("ShrUpl").yellow().bold());
|
||||||
|
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn prompt_continue() -> bool {
|
pub fn prompt_continue() -> bool {
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ impl fmt::Display for FileID {
|
||||||
/// - `/files/tus/` - literal path segment
|
/// - `/files/tus/` - literal path segment
|
||||||
/// - `(?P<fid>[^/]+)` - capture FID (one or more non-slash chars)
|
/// - `(?P<fid>[^/]+)` - capture FID (one or more non-slash chars)
|
||||||
/// - `$` - end of string
|
/// - `$` - end of string
|
||||||
const UPLOAD_URL_RE: LazyLock<Regex> = LazyLock::new(|| {
|
static UPLOAD_URL_RE: LazyLock<Regex> = LazyLock::new(|| {
|
||||||
trace!("compiling UPLOAD_URL_RE");
|
trace!("compiling UPLOAD_URL_RE");
|
||||||
|
|
||||||
Regex::new(r"^([^:/?#]+)://([^/?#]+)/api/v2/alias/upload/[^/]+/files/tus/(?P<fid>[^/]+)$")
|
Regex::new(r"^([^:/?#]+)://([^/?#]+)/api/v2/alias/upload/[^/]+/files/tus/(?P<fid>[^/]+)$")
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ fn captured(caps: &Captures, name: &str) -> String {
|
||||||
/// - `(?P<host>[^/?#]+)` - capture authority/host (anything but `/?#`)
|
/// - `(?P<host>[^/?#]+)` - capture authority/host (anything but `/?#`)
|
||||||
/// - `(/.*)?` - maybe trailing slash and some path
|
/// - `(/.*)?` - maybe trailing slash and some path
|
||||||
/// - `$` - end of string
|
/// - `$` - end of string
|
||||||
const SHARRY_URI_RE: LazyLock<Regex> = LazyLock::new(|| {
|
static SHARRY_URI_RE: LazyLock<Regex> = LazyLock::new(|| {
|
||||||
trace!("compiling SHARRY_URI_RE");
|
trace!("compiling SHARRY_URI_RE");
|
||||||
|
|
||||||
Regex::new(r"^(?P<scheme>[^:/?#]+)://(?P<host>[^/?#]+)(/.*)?$")
|
Regex::new(r"^(?P<scheme>[^:/?#]+)://(?P<host>[^/?#]+)(/.*)?$")
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue