mirror of
https://github.com/mgeeky/decode-spam-headers.git
synced 2024-11-22 02:21:37 +01:00
Fix that hopefully addresses issues/3
This commit is contained in:
parent
71a97db7a1
commit
02fb5aafe3
@ -1770,6 +1770,7 @@ class SMTPHeadersAnalysis:
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def safeBase64Decode(value):
|
def safeBase64Decode(value):
|
||||||
enc = False
|
enc = False
|
||||||
|
|
||||||
if type(value) == str:
|
if type(value) == str:
|
||||||
enc = True
|
enc = True
|
||||||
value = value.encode()
|
value = value.encode()
|
||||||
@ -1777,10 +1778,13 @@ class SMTPHeadersAnalysis:
|
|||||||
try:
|
try:
|
||||||
out = base64.b64decode(value)
|
out = base64.b64decode(value)
|
||||||
except:
|
except:
|
||||||
out = base64.b64decode(value + b'=' * (-len(value) % 4))
|
try:
|
||||||
|
out = base64.b64decode(value + b'=' * (-len(value) % 4))
|
||||||
|
except:
|
||||||
|
out = value
|
||||||
|
|
||||||
if enc:
|
if enc:
|
||||||
out = out.decode()
|
out = out.decode(errors = 'ignore')
|
||||||
|
|
||||||
return out
|
return out
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user