diff options
author | Bence Ferdinandy <bence@ferdinandy.com> | 2024-03-13 13:48:38 +0100 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2024-03-25 23:11:22 +0100 |
commit | 6ffc0ed5991bef69a50cbc22647af0a6a0e0a895 (patch) | |
tree | 268c12d3a9104ae5b5580eda15488914a8abcd6b /app | |
parent | 523ca15a3b4882a4e49eb4736cc2d5d11b8df9a7 (diff) | |
download | aerc-6ffc0ed5991bef69a50cbc22647af0a6a0e0a895.tar.gz |
filters: add matching against attachment filename
The mimetype of attachments are set by the sender, which can results in
attachments getting not so useful mimetypes (e.g.
application/octet-stream for a csv). Allow matching filter against
filenames directly, by adding the `.filename,` and `.filename,~` syntax,
similarly to headers.
Changelog-added: Match filters on filename via `.filename,~<regexp> =`.
Signed-off-by: Bence Ferdinandy <bence@ferdinandy.com>
Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'app')
-rw-r--r-- | app/msgviewer.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/app/msgviewer.go b/app/msgviewer.go index 7b24e756..a78daa3a 100644 --- a/app/msgviewer.go +++ b/app/msgviewer.go @@ -480,6 +480,11 @@ func NewPartViewer( if f.Regex.Match([]byte(header)) { filter = exec.Command("sh", "-c", f.Command) } + case config.FILTER_FILENAME: + if f.Regex.Match([]byte(part.DispositionParams["filename"])) { + filter = exec.Command("sh", "-c", f.Command) + log.Tracef("command %v", f.Command) + } } if filter != nil { break |