[elbe-devel] [PATCH] Python3: make archivedir's enbase compatible

torben.hohn at linutronix.de torben.hohn at linutronix.de
Fri Jan 24 20:06:26 CET 2020


On Mon, Jan 20, 2020 at 08:49:45PM +0100, bage at linutronix.de wrote:
> From: Bastian Germann <bage at linutronix.de>
> 
> base64 input should be bytes, so open the file with the right flag.
> Decode the (ASCII) output so that the following string concatenation works.
> 
> Signed-off-by: Bastian Germann <bage at linutronix.de>
>

Reviewed-by: Torben Hohn <torbenh.hohn at linutronix.de>

> ---
>  elbepack/archivedir.py | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/elbepack/archivedir.py b/elbepack/archivedir.py
> index fcff10888..785a8ac82 100644
> --- a/elbepack/archivedir.py
> +++ b/elbepack/archivedir.py
> @@ -27,12 +27,12 @@ class ArchivedirError(Exception):
>      pass
>  
>  def enbase(fname, compress=True):
> -    infile = open(fname, "r")
> +    infile = open(fname, "rb")
>      s = infile.read()
>      if compress:
>          s = bz2compress(s)
>  
> -    enc = standard_b64encode(s)
> +    enc = standard_b64encode(s).decode()
>      splited = ""
>      i = 0
>      l_enc = len(enc)
> -- 
> 2.20.1
> 
> 
> _______________________________________________
> elbe-devel mailing list
> elbe-devel at linutronix.de
> https://lists.linutronix.de/mailman/listinfo/elbe-devel



More information about the elbe-devel mailing list