From: Wolfgang Bumiller <w.bumiller@proxmox.com>
To: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
Cc: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] applied: [PATCH proxmox-backup] file-restore: add context to b64-decode error
Date: Fri, 23 Apr 2021 13:23:40 +0200 [thread overview]
Message-ID: <20210423112340.lmstzf6rhu7x5qia@wobu-vie.proxmox.com> (raw)
In-Reply-To: <20210423110047.1416950-1-f.gruenbichler@proxmox.com>
applied and replaced the .clone() with a reference
On Fri, Apr 23, 2021 at 01:00:47PM +0200, Fabian Grünbichler wrote:
> to make the following cryptic error:
>
> proxmox-file-restore failed: Error: Invalid byte 46, offset 5.
>
> more understandable:
>
> proxmox-file-restore failed: Error: Failed base64-decoding path '/root.pxar.didx' - Invalid byte 46, offset 5.
>
> when a user passes in a non-base64 path but sets `--base64`.
>
> Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
> ---
>
> Notes:
> this can happen via the PVE integration, which always sets the base64 flag
> except for the special value '/'.
>
> src/bin/proxmox-file-restore.rs | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/bin/proxmox-file-restore.rs b/src/bin/proxmox-file-restore.rs
> index 3d750152..bb8261bb 100644
> --- a/src/bin/proxmox-file-restore.rs
> +++ b/src/bin/proxmox-file-restore.rs
> @@ -47,7 +47,8 @@ enum ExtractPath {
>
> fn parse_path(path: String, base64: bool) -> Result<ExtractPath, Error> {
> let mut bytes = if base64 {
> - base64::decode(path)?
> + base64::decode(path.clone())
decode takes a `T: AsRef<[u8]>` which works fine for references, so this
can just be
base64::decode(&path)
> + .map_err(|err| format_err!("Failed base64-decoding path '{}' - {}", path, err))?
> } else {
> path.into_bytes()
> };
> --
> 2.20.1
prev parent reply other threads:[~2021-04-23 11:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-23 11:00 [pbs-devel] " Fabian Grünbichler
2021-04-23 11:23 ` Wolfgang Bumiller [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210423112340.lmstzf6rhu7x5qia@wobu-vie.proxmox.com \
--to=w.bumiller@proxmox.com \
--cc=f.gruenbichler@proxmox.com \
--cc=pbs-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.