From f14a8c9a858f3d04fc871601d120261bc934e5cd Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Tue, 25 Jun 2019 12:59:36 +0200 Subject: [PATCH] src/api2/admin/datastore.rs: use correct path for download --- src/api2/admin/datastore.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/api2/admin/datastore.rs b/src/api2/admin/datastore.rs index ae6092de..9dd82f15 100644 --- a/src/api2/admin/datastore.rs +++ b/src/api2/admin/datastore.rs @@ -402,6 +402,9 @@ fn download_file( ) -> Result { let store = tools::required_string_param(¶m, "store")?; + + let datastore = DataStore::lookup_datastore(store)?; + let file_name = tools::required_string_param(¶m, "file-name")?.to_owned(); let backup_type = tools::required_string_param(¶m, "backup-type")?; @@ -413,10 +416,11 @@ fn download_file( let backup_dir = BackupDir::new(backup_type, backup_id, backup_time); - let mut path = backup_dir.relative_path(); + let mut path = datastore.base_path(); + path.push(backup_dir.relative_path()); path.push(&file_name); - let response_future = tokio::fs::File::open(file_name) + let response_future = tokio::fs::File::open(path) .map_err(|err| http_err!(BAD_REQUEST, format!("File open failed: {}", err))) .and_then(move |file| { let payload = tokio::codec::FramedRead::new(file, tokio::codec::BytesCodec::new()).