Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ahsee opened this issue Jul 17, 2022 · 1 comment

Comments

@ahsee
Copy link

ahsee commented Jul 17, 2022

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 ahsee changed the title Error when attempting to set yyyy-mm regex for foldername Error when attempting to save threads and PDFs to yyyy/MM folder structures Jul 18, 2022
@ahsee ahsee changed the title Error when attempting to save threads and PDFs to yyyy/MM folder structures Error when attempting to save threads and attachments to yyyy/MM folder structures Jul 18, 2022
@marcusschweizer
Copy link
Contributor

I encountered this error as well, I believe the processThreadToPdf() function does not create the folder name as expected so this occurs in any email that uses "saveThreadPDF": true.

marcusschweizer added a commit to marcusschweizer/gmail2gdrive that referenced this issue Dec 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants