diff --git a/src/api2/admin/datastore.rs b/src/api2/admin/datastore.rs index 94ed1182..3df50aa0 100644 --- a/src/api2/admin/datastore.rs +++ b/src/api2/admin/datastore.rs @@ -1,7 +1,6 @@ use std::collections::{HashSet, HashMap}; use std::convert::TryFrom; -use chrono::{TimeZone, Local}; use anyhow::{bail, Error}; use futures::*; use hyper::http::request::Parts; @@ -748,8 +747,7 @@ fn download_file( let allowed = (user_privs & PRIV_DATASTORE_READ) != 0; if !allowed { check_backup_owner(&datastore, backup_dir.group(), &username)?; } - println!("Download {} from {} ({}/{}/{}/{})", file_name, store, - backup_type, backup_id, Local.timestamp(backup_time, 0), file_name); + println!("Download {} from {} ({}/{})", file_name, store, backup_dir, file_name); let mut path = datastore.base_path(); path.push(backup_dir.relative_path()); diff --git a/src/backup/backup_info.rs b/src/backup/backup_info.rs index 60b61f89..3908709a 100644 --- a/src/backup/backup_info.rs +++ b/src/backup/backup_info.rs @@ -212,6 +212,15 @@ impl BackupDir { } } +impl std::fmt::Display for BackupDir { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + let backup_type = self.group.backup_type(); + let id = self.group.backup_id(); + let time = Self::backup_time_to_string(self.backup_time); + write!(f, "{}/{}/{}", backup_type, id, time) + } +} + impl From<(BackupGroup, i64)> for BackupDir { fn from((group, timestamp): (BackupGroup, i64)) -> Self { Self { group, backup_time: Utc.timestamp(timestamp, 0) }