api: always use complete file names (including add exctensions)

This commit is contained in:
Dietmar Maurer
2019-08-07 10:10:14 +02:00
parent d7c243977d
commit 4af0ee055a
3 changed files with 24 additions and 29 deletions

View File

@ -242,13 +242,15 @@ fn upload_blob(
rpcenv: Box<dyn RpcEnvironment>,
) -> Result<BoxFut, Error> {
let mut file_name = tools::required_string_param(&param, "file-name")?.to_owned();
let file_name = tools::required_string_param(&param, "file-name")?.to_owned();
let encoded_size = tools::required_integer_param(&param, "encoded-size")? as usize;
let env: &BackupEnvironment = rpcenv.as_ref();
file_name.push_str(".blob");
if !file_name.ends_with(".blob") {
bail!("wrong blob file extension: '{}'", file_name);
}
let env2 = env.clone();
let env3 = env.clone();