diff --git a/src/api2/admin/datastore/catar.rs b/src/api2/admin/datastore/catar.rs index 5c073e0e..29a7849f 100644 --- a/src/api2/admin/datastore/catar.rs +++ b/src/api2/admin/datastore/catar.rs @@ -55,7 +55,13 @@ fn upload_catar( ) -> Result { let store = tools::required_string_param(¶m, "store")?; - let archive_name = tools::required_string_param(¶m, "archive_name")?; + let mut archive_name = String::from(tools::required_string_param(¶m, "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(¶m, "type")?; let backup_id = tools::required_string_param(¶m, "id")?; @@ -77,10 +83,7 @@ fn upload_catar( let mut path = datastore.create_backup_dir(backup_type, backup_id, backup_time)?; - let mut full_archive_name = PathBuf::from(archive_name); - full_archive_name.set_extension("didx"); - - path.push(full_archive_name); + path.push(archive_name); let index = datastore.create_dynamic_writer(path, chunk_size)?;