api/datastore: allow pxar file download of entire archive
Treat filepaths like "/root.pxar.didx" without a trailing slash as wanting to download the entire archive content instead of erroring. The zip-creation code already works fine for this scenario. Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
This commit is contained in:
parent
a38dccf0e8
commit
0dfce17a43
@ -1385,7 +1385,7 @@ pub fn pxar_file_download(
|
|||||||
|
|
||||||
let mut split = components.splitn(2, |c| *c == b'/');
|
let mut split = components.splitn(2, |c| *c == b'/');
|
||||||
let pxar_name = std::str::from_utf8(split.next().unwrap())?;
|
let pxar_name = std::str::from_utf8(split.next().unwrap())?;
|
||||||
let file_path = split.next().ok_or_else(|| format_err!("filepath looks strange '{}'", filepath))?;
|
let file_path = split.next().unwrap_or(b"/");
|
||||||
let (manifest, files) = read_backup_index(&datastore, &backup_dir)?;
|
let (manifest, files) = read_backup_index(&datastore, &backup_dir)?;
|
||||||
for file in files {
|
for file in files {
|
||||||
if file.filename == pxar_name && file.crypt_mode == Some(CryptMode::Encrypt) {
|
if file.filename == pxar_name && file.crypt_mode == Some(CryptMode::Encrypt) {
|
||||||
|
Loading…
Reference in New Issue
Block a user