Ensure b64 prefs always have min padding
This relates to an issue with an unknown cause (unable to reproduce on my end) where the preferences string does not contain the correct amount of padding on a base64 encoded value. This is mediated by appending padding to the end of the encoded value, since any extra padding is removed anyways. Fixes #987main
parent
2cb4b9e3ca
commit
f213a2a64a
|
@ -254,7 +254,8 @@ class Config:
|
||||||
key = self._get_fernet_key(self.preferences_key)
|
key = self._get_fernet_key(self.preferences_key)
|
||||||
|
|
||||||
config = Fernet(key).decrypt(
|
config = Fernet(key).decrypt(
|
||||||
brotli.decompress(urlsafe_b64decode(preferences.encode()))
|
brotli.decompress(urlsafe_b64decode(
|
||||||
|
preferences.encode() + b'=='))
|
||||||
)
|
)
|
||||||
|
|
||||||
config = pickle.loads(brotli.decompress(config))
|
config = pickle.loads(brotli.decompress(config))
|
||||||
|
@ -262,7 +263,8 @@ class Config:
|
||||||
config = {}
|
config = {}
|
||||||
elif mode == 'u': # preferences are not encrypted
|
elif mode == 'u': # preferences are not encrypted
|
||||||
config = pickle.loads(
|
config = pickle.loads(
|
||||||
brotli.decompress(urlsafe_b64decode(preferences.encode()))
|
brotli.decompress(urlsafe_b64decode(
|
||||||
|
preferences.encode() + b'=='))
|
||||||
)
|
)
|
||||||
else: # preferences are incorrectly formatted
|
else: # preferences are incorrectly formatted
|
||||||
config = {}
|
config = {}
|
||||||
|
|
Loading…
Reference in New Issue