From f677633c69f0df3cb7a4b809dd3f695060ff1321 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxime=20=E2=80=9Cpep=E2=80=9D=20Buquet?= Date: Fri, 24 Sep 2021 10:45:34 +0200 Subject: [PATCH] Add comment to highlight conflict prevention MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We use dark magic to prevent illegal chars on a range of filesystems, same as the omemo library uses. Maybe that should be abstracted away. Signed-off-by: Maxime “pep” Buquet --- poezio_omemo/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/poezio_omemo/__init__.py b/poezio_omemo/__init__.py index d6b4b77..4eba924 100644 --- a/poezio_omemo/__init__.py +++ b/poezio_omemo/__init__.py @@ -70,9 +70,11 @@ class Plugin(E2EEPlugin): self.info = lambda i: self.api.information(i, 'Info') + # Ensure folder names don't contain illegal chars for the FS jid_str = self.core.xmpp.boundjid.bare.encode('utf-8') digest = hashlib.sha256(jid_str).digest() hashed_jid = base64.b32encode(digest).decode('US-ASCII') + data_dir = os.path.join(DATA_HOME, 'omemo', hashed_jid) try: