src/api2/admin/datastore/catar.rs: use archive_name directly

This commit is contained in:
Dietmar Maurer 2019-03-06 10:47:09 +01:00
parent a6b7551311
commit dd79265a8a

View File

@ -12,7 +12,7 @@ use chrono::{Local, TimeZone};
use serde_json::Value; use serde_json::Value;
use std::io::Write; use std::io::Write;
use futures::*; use futures::*;
use std::path::PathBuf; //use std::path::PathBuf;
use std::sync::Arc; use std::sync::Arc;
use hyper::Body; use hyper::Body;
@ -139,7 +139,7 @@ fn download_catar(
let backup_id = tools::required_string_param(&param, "backup-id")?; let backup_id = tools::required_string_param(&param, "backup-id")?;
let backup_time = tools::required_integer_param(&param, "backup-time")?; let backup_time = tools::required_integer_param(&param, "backup-time")?;
println!("Download {}.catar from {} ({}/{}/{}/{}.didx)", archive_name, store, println!("Download {} from {} ({}/{}/{}/{})", archive_name, store,
backup_type, backup_id, Local.timestamp(backup_time, 0), archive_name); backup_type, backup_id, Local.timestamp(backup_time, 0), archive_name);
let datastore = DataStore::lookup_datastore(store)?; let datastore = DataStore::lookup_datastore(store)?;
@ -147,11 +147,7 @@ fn download_catar(
let backup_dir = BackupDir::new(backup_type, backup_id, backup_time); let backup_dir = BackupDir::new(backup_type, backup_id, backup_time);
let mut path = backup_dir.relative_path(); let mut path = backup_dir.relative_path();
path.push(archive_name);
let mut full_archive_name = PathBuf::from(archive_name);
full_archive_name.set_extension("didx");
path.push(full_archive_name);
let index = datastore.open_dynamic_reader(path)?; let index = datastore.open_dynamic_reader(path)?;
let reader = BufferedDynamicReader::new(index); let reader = BufferedDynamicReader::new(index);