Skip to content

Commit

Permalink
Hotfix fake base64 attachments 'KeyError'
Browse files Browse the repository at this point in the history
  • Loading branch information
fedelemantuano committed Mar 16, 2019
1 parent 059a690 commit 14a4bfe
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion project.clj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(defproject spamscope "2.8.0-SNAPSHOT"
(defproject spamscope "2.8.1-SNAPSHOT"
:resource-paths ["_resources"]
:target-path "_build"
:min-lein-version "2.0.0"
Expand Down
8 changes: 6 additions & 2 deletions src/modules/attachments/attachments.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,10 +354,14 @@ def withhashes(cls, attachments=[]):
payload = base64.b64decode(i["payload"])
except TypeError, e:
try:
# try to add === to decode base64
payload = base64.b64decode(i["payload"] + "===")
i.setdefault("errors", []).append(repr(e))
except TypeError:
continue
# if fails maybe is text, with fake base64 header
payload = i["payload"]
finally:
i.setdefault("errors", []).append(
repr(e) + " Fake base64")
else:
payload = i["payload"]

Expand Down
2 changes: 1 addition & 1 deletion src/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

from os.path import join

__version__ = "2.8.0"
__version__ = "2.8.1"
__configuration_path__ = "/etc/spamscope"

__defaults__ = {
Expand Down

0 comments on commit 14a4bfe

Please sign in to comment.