[elbe-devel] [PATCH 1/6] elbepack: finetuning: fix file base64 encoding

Thomas Weißschuh thomas.weissschuh at linutronix.de
Mon Jan 27 09:59:15 CET 2025


standard_b64decode() always returns bytes, but the methods from the
elbepack.filesystem.Filestem() that these are passed to expect a string.
This probably worked on Python 2 but it doesn't today.
While it would be nice to use arbitrary binary data with <file>,
that is a feature change for the future.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
 elbepack/finetuning.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/elbepack/finetuning.py b/elbepack/finetuning.py
index 1fcb632d17719d7fb99b33d94d373bdc6e400250..dfe584c7c84787e4f9b67f7cad2474eb1eedaea4 100644
--- a/elbepack/finetuning.py
+++ b/elbepack/finetuning.py
@@ -249,7 +249,7 @@ class AddFileAction(FinetuningAction):
         elif encoding == 'raw':
             msg = '\n'.join(text.splitlines()[1:-1])
         elif encoding == 'base64':
-            msg = base64.standard_b64decode(text)
+            msg = base64.standard_b64decode(text).decode('ascii')
         else:
             raise FinetuningException(f'Invalid encoding {encoding}')
         return msg

-- 
2.48.1



More information about the elbe-devel mailing list