HandyGuySoftware / dupReport

Email summary reporting tool for use with Duplicati backup system
MIT License
77 stars 9 forks source link

Subject regex not working #154

Closed jrwrigh closed 4 years ago

jrwrigh commented 4 years ago

Hello. I'm using version 2.2.12. In my rc file, I have subjectregex = ^Duplicati. In the log running the command, this is parsed correctly:

...
options.readRcOptions(***********************************************************************)
Parsed config option [destregex]=[\w*]
Parsed config option [inaccount]=[*****************************]
Parsed config option [collect]=[False]
Parsed config option [subjectregex]=[^Duplicati]
...

However, it still reads a file with the subject line "Security alert":

remail.processNextMessage()
EmailServer.Connect()
dremail.extractHeaders(Date: Sat, 04 Jul 2020 17:58:03 GMTM
Message-ID: <iruyrLgkAaN5xBpgvQ7q0w.0@notifications.google.com>M
Subject: Security alertM
M
)
Header fields extracted: date=[Sat, 04 Jul 2020 17:58:03 GMT] subject=[Security alert]  message-id=[<iruyrLgkAaN5xBpgvQ7q0w.0@notifications.google.com>]

which causes the process to fail with:

Traceback (most recent call last):
  File "/share/CACHEDEV1_DATA/homes/admin/dupReport-Release_2.2.12/dupReport.py", line 240, in <module>
    nxtMsg = globs.inServer.processNextMessage()
  File "/share/CACHEDEV1_DATA/homes/admin/dupReport-Release_2.2.12/dremail.py", line 339, in processNextMessage
    msgParts['date'], msgParts['subject'], msgParts['messageId'], msgParts['content-transfer-encoding']= self.extractHeaders(data[0][1].decode('utf-8'))
  File "/share/CACHEDEV1_DATA/homes/admin/dupReport-Release_2.2.12/dremail.py", line 299, in extractHeaders
    return hdrFields['date'], hdrFields['subject'], hdrFields['message-id'], hdrFields['content-transfer-encoding']
KeyError: 'content-transfer-encoding'
jrwrigh commented 4 years ago

Looking at the source code, the issue is not that the regex isn't working, but that it is requiring that the header Field ['content-transfer-encoding'] exist before checking the regex.

HandyGuySoftware commented 4 years ago

Unfortunately, I don't have the ability to modify & release past releases. However, version 3.0 includes a check if the 'content-transfer-encoding' field is present and, if not, defaults it to a blank value. Check out that version to see if that addresses your issue.

jrwrigh commented 4 years ago

Yep, I tried that and ran into the issue described in #153.

HandyGuySoftware commented 4 years ago

OK. Fix for Issue #153 is being tested now and should be updated in the master branch soon.