Backup files must end with .backup

This commit is contained in:
Dennis Schwerdel 2017-04-12 18:11:40 +02:00
parent 259b12e35f
commit 0354a73f54
2 changed files with 5 additions and 2 deletions

View File

@ -168,7 +168,10 @@ impl Backup {
paths.push(path); paths.push(path);
} else { } else {
let relpath = path.strip_prefix(&base_path).unwrap(); let relpath = path.strip_prefix(&base_path).unwrap();
let name = relpath.to_string_lossy().to_string(); if relpath.extension() != Some(".backup".as_ref()) {
continue
}
let name = relpath.file_stem().unwrap().to_string_lossy().to_string();
if let Ok(backup) = Backup::read_from(crypto, &path) { if let Ok(backup) = Backup::read_from(crypto, &path) {
backups.insert(name, backup); backups.insert(name, backup);
} else { } else {

View File

@ -52,7 +52,7 @@ impl RepositoryLayout {
#[inline] #[inline]
pub fn backup_path(&self, name: &str) -> PathBuf { pub fn backup_path(&self, name: &str) -> PathBuf {
self.backups_path().join(name) self.backups_path().join(format!("{}.backup", name))
} }
#[inline] #[inline]