diff options
author | Emilio Pozuelo Monfort <pochu@debian.org> | 2020-07-17 11:54:10 +0200 |
---|---|---|
committer | Emilio Pozuelo Monfort <pochu@debian.org> | 2020-07-29 10:20:41 +0200 |
commit | 5bb67bfaf06d456c4c46ea7575e496d2443960bf (patch) | |
tree | 881ffe317f76bd252e5fead8d4db169c29ea04c3 /lib | |
parent | 31261f3aa25e090b7a6d3ff231eb46e342203181 (diff) |
security_db: encode data before passing it to base64
In python3, base64 takes bytes.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/python/security_db.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/python/security_db.py b/lib/python/security_db.py index a3d3052cb2..c179f6d91f 100644 --- a/lib/python/security_db.py +++ b/lib/python/security_db.py @@ -1531,7 +1531,7 @@ class DB: kind, urgency_to_flag[urgency], remote, fix_available, package, fixed_version, description)) - result = base64.encodestring(zlib.compress(''.join(result), 9)) + result = base64.encodestring(zlib.compress(''.join(result).encode('utf-8'), 9)) c.execute( "INSERT OR REPLACE INTO debsecan_data (name, data) VALUES (?, ?)", @@ -1702,7 +1702,7 @@ class DB: source_packages.sort() def store_value(name, value): - value = base64.encodestring(zlib.compress(value, 9)) + value = base64.encodestring(zlib.compress(value.encode('utf-8'), 9)) c.execute("""INSERT OR REPLACE INTO debsecan_data VALUES (?, ?)""", (name, value)) @@ -1753,7 +1753,7 @@ class DB: """Returns the debsecan data item NAME.""" for (data,) in self.cursor().execute( "SELECT data FROM debsecan_data WHERE name = ?", (name,)): - return base64.decodestring(data) + return base64.decodestring(data.encode('utf-8')) else: return None |