jonaswinkler / paperless-ng

A supercharged version of paperless: scan, index and archive all your physical documents
https://paperless-ng.readthedocs.io/en/latest/
GNU General Public License v3.0
5.37k stars 356 forks source link

[BUG] Mail rule filter attachment filename is case sensitive #1394

Open dpaulat opened 2 years ago

dpaulat commented 2 years ago

The "Mail rules" interface says the Filter attachment filename should be case insensitive:

Only consume documents which entirely match this filename if specified. Wildcards such as .pdf or *invoice\ are allowed. Case insensitive.

The latest revision of mail.py uses fnmatch, which follows the operating system's rules for case sensitivity:

https://github.com/jonaswinkler/paperless-ng/blob/7bc8325df910ab57ed07849a3ce49a3011ba55b6/src/paperless_mail/mail.py#L279-L281

amenk commented 2 years ago

I guess a possible patch would be

            if not fnmatch(att.filename.lower(), rule.filter_attachment_filename.lower()):

Do you mind making a PR?