src/backup/manifest.rs: check if manifest contains files

This commit is contained in:
Dietmar Maurer 2020-01-23 11:16:12 +01:00
parent 68a6a0ee03
commit 51534c8de9

View File

@ -135,6 +135,11 @@ impl TryFrom<Value> for BackupManifest {
let size = required_integer_property(item, "size")? as u64; let size = required_integer_property(item, "size")? as u64;
manifest.add_file(filename, size, csum)?; manifest.add_file(filename, size, csum)?;
} }
if manifest.files().is_empty() {
bail!("manifest does not list any files.");
}
Ok(manifest) Ok(manifest)
}).map_err(|err: Error| format_err!("unable to parse backup manifest - {}", err)) }).map_err(|err: Error| format_err!("unable to parse backup manifest - {}", err))