client restore: don't add server file ending if already specified

If one executes a client command like
 # proxmox-backup-client files <snapshot> --repository ...
the files shown have already the '.fidx' or '.blob' file ending, so
if a user would just copy paste that one the client would always add
.blob, and the server would not find that file.

So avoid adding file endings if it is already a known OK one.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2020-06-02 18:41:32 +02:00 committed by Dietmar Maurer
parent dc155e9bd7
commit 2d32fe2c04

View File

@ -1108,7 +1108,9 @@ fn dump_image<W: Write>(
}
fn parse_archive_type(name: &str) -> (String, ArchiveType) {
if name.ends_with(".pxar") {
if name.ends_with(".didx") || name.ends_with(".fidx") || name.ends_with(".blob") {
(name.into(), archive_type(name).unwrap())
} else if name.ends_with(".pxar") {
(format!("{}.didx", name), ArchiveType::DynamicIndex)
} else if name.ends_with(".img") {
(format!("{}.fidx", name), ArchiveType::FixedIndex)