gmail-processor icon indicating copy to clipboard operation
gmail-processor copied to clipboard

Error when attempting to save threads and attachments to yyyy/MM folder structures

Open ahsee opened this issue 2 years ago • 0 comments

I'm attempting to have both threads and attachments saved in the same folder, grouped by subject, nested within date-based sub-folders.

I attempted to follow the methodology employed in #36 however I'm getting unexpected results.

I am sure I am getting something wrong with the naming convention for the folder value in config.gs, but I've tried many combinations without success. Sometimes I can get the attachments saving with correctly labelled folders, but the threads get saved in erroneous folder names.


Example:

Payslip.msg (with attachment "PayslipJuly.pdf"), Sent July 2022 With label 'finance-related-payslips'

Expected outputs (2 files in same path): Payslips > 2022 > July > Payslip > Payslip.pdf (formerly .msg) Payslips > 2022 > July > Payslip > PayslipJuly.pdf

Actual output Payslips > YYYY > MM > Payslip.pdf (formerly .msg) No attachments.


Artefacts:

Global filter (just to confirm I'm not leaving out anything relevant):

    // Global filter
    "globalFilter": "-in:trash -in:drafts -in:spam",

Offending rule:

// Processing rules:
"rules": [
  {
    // Store threads marked with label "Finance Related/Payslips" in the folder "Payslips" as PDF document.
    "filter": "label:finance-related-payslips",
    "saveThreadPDF": true,
    "folder": "Payslips'/yyyy/MM/%s",
  },

Relevant execution log snippet:

11:16:06 PM
Info
INFO:     Processing thread: FW: Payslip for January 2022 (runtime: 4.757s/280s)
11:16:06 PM
Info
INFO:     Message in trash:false
11:16:06 PM
Info
INFO:       Processing message: FW: Payslip for January 2022 (1820a633ca8c45e0)
11:16:06 PM
Info
INFO:         Processing attachment: PaySlip.pdf
11:16:06 PM
Info
Exception: Invalid argument: Payslips/yyyy/MM/%s
11:16:06 PM
Info
INFO: Saving PDF copy of thread 'FW: Payslip for January 2022'
11:16:07 PM
Info
INFO:   Generating HTML code of thread 'FW: Payslip for January 2022'
11:16:07 PM
Info
INFO:     Message in trash:false
11:16:07 PM
Info
INFO:     Message not in trash: processing.
11:16:09 PM
Info
INFO:     Processing thread: FW: Payslip for December 2021 (runtime: 8.065s/280s)
11:16:09 PM
Info
INFO:     Message in trash:false
11:16:09 PM
Info
INFO:       Processing message: FW: Payslip for December 2021 (1820a6339251c695)
11:16:09 PM
Info
INFO:         Processing attachment: PaySlip.pdf
11:16:09 PM
Info
Exception: Invalid argument: Payslips/yyyy/MM/%s

Appreciate any assistance as I am sure I am getting a lot wrong - I am sure this is a very powerful tool once I get the hang of it!

ahsee avatar Jul 17 '22 13:07 ahsee