api2/admin/datastore/catar.rs: use nested file extensions

i.e. archive.catar.didx
This commit is contained in:
Dietmar Maurer 2019-02-13 10:37:00 +01:00
parent e5064ba607
commit 541a302224

View File

@ -55,7 +55,13 @@ fn upload_catar(
) -> Result<BoxFut, Error> { ) -> Result<BoxFut, Error> {
let store = tools::required_string_param(&param, "store")?; let store = tools::required_string_param(&param, "store")?;
let archive_name = tools::required_string_param(&param, "archive_name")?; let mut archive_name = String::from(tools::required_string_param(&param, "archive_name")?);
if !archive_name.ends_with(".catar") {
bail!("got wront file extension (expected '.catar')");
}
archive_name.push_str(".didx");
let backup_type = tools::required_string_param(&param, "type")?; let backup_type = tools::required_string_param(&param, "type")?;
let backup_id = tools::required_string_param(&param, "id")?; let backup_id = tools::required_string_param(&param, "id")?;
@ -77,10 +83,7 @@ fn upload_catar(
let mut path = datastore.create_backup_dir(backup_type, backup_id, backup_time)?; let mut path = datastore.create_backup_dir(backup_type, backup_id, backup_time)?;
let mut full_archive_name = PathBuf::from(archive_name); path.push(archive_name);
full_archive_name.set_extension("didx");
path.push(full_archive_name);
let index = datastore.create_dynamic_writer(path, chunk_size)?; let index = datastore.create_dynamic_writer(path, chunk_size)?;