feat: implement more webdav methods (#13)

Now you can mount the server as webdav driver on windows.
This commit is contained in:
sigoden
2022-06-04 19:08:18 +08:00
committed by GitHub
parent 4605701366
commit 05155aa532
3 changed files with 126 additions and 72 deletions

View File

@@ -113,7 +113,8 @@ pub struct Args {
pub address: String,
pub port: u16,
pub path: PathBuf,
pub path_prefix: Option<String>,
pub path_prefix: String,
pub uri_prefix: String,
pub auth: Option<String>,
pub no_auth_access: bool,
pub allow_upload: bool,
@@ -136,7 +137,13 @@ impl Args {
let path = Args::parse_path(matches.value_of_os("path").unwrap_or_default())?;
let path_prefix = matches
.value_of("path-prefix")
.map(|v| v.trim_matches('/').to_owned());
.map(|v| v.trim_matches('/').to_owned())
.unwrap_or_default();
let uri_prefix = if path_prefix.is_empty() {
"/".to_owned()
} else {
format!("/{}/", &path_prefix)
};
let cors = matches.is_present("cors");
let auth = matches.value_of("auth").map(|v| v.to_owned());
let no_auth_access = matches.is_present("no-auth-access");
@@ -159,6 +166,7 @@ impl Args {
port,
path,
path_prefix,
uri_prefix,
auth,
no_auth_access,
cors,