mirror of
https://github.com/void-linux/void-packages.git
synced 2025-08-03 19:32:57 +02:00
afew: backport upstream fix for HeaderMatchingFilter error
This commit is contained in:
parent
aeb04ef10e
commit
6c3db61b7a
2 changed files with 39 additions and 2 deletions
37
srcpkgs/afew/patches/nullpointererror-fix.patch
Normal file
37
srcpkgs/afew/patches/nullpointererror-fix.patch
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
based on upstream commit d43508dc2bb456070192239d02fb8079b433781c
|
||||||
|
backports fix: HeaderMatchingFilter: Gracefully handle missing headers
|
||||||
|
|
||||||
|
diff --git a/afew/filters/HeaderMatchingFilter.py b/afew/filters/HeaderMatchingFilter.py
|
||||||
|
index 5a735f7..95198d7 100644
|
||||||
|
--- a/afew/filters/HeaderMatchingFilter.py
|
||||||
|
+++ b/afew/filters/HeaderMatchingFilter.py
|
||||||
|
@@ -6,6 +6,8 @@
|
||||||
|
|
||||||
|
from afew.filters.BaseFilter import Filter
|
||||||
|
|
||||||
|
+from notmuch.errors import NullPointerError
|
||||||
|
+
|
||||||
|
import re
|
||||||
|
|
||||||
|
|
||||||
|
@@ -22,10 +24,13 @@ class HeaderMatchingFilter(Filter):
|
||||||
|
def handle_message(self, message):
|
||||||
|
if self.header is not None and self.pattern is not None:
|
||||||
|
if not self._tag_blacklist.intersection(message.get_tags()):
|
||||||
|
- value = message.get_header(self.header)
|
||||||
|
- match = self.pattern.search(value)
|
||||||
|
- if match:
|
||||||
|
- sub = (lambda tag:
|
||||||
|
- tag.format(**match.groupdict()).lower())
|
||||||
|
- self.remove_tags(message, *map(sub, self._tags_to_remove))
|
||||||
|
- self.add_tags(message, *map(sub, self._tags_to_add))
|
||||||
|
+ try:
|
||||||
|
+ value = message.get_header(self.header)
|
||||||
|
+ match = self.pattern.search(value)
|
||||||
|
+ if match:
|
||||||
|
+ sub = (lambda tag:
|
||||||
|
+ tag.format(**match.groupdict()).lower())
|
||||||
|
+ self.remove_tags(message, *map(sub, self._tags_to_remove))
|
||||||
|
+ self.add_tags(message, *map(sub, self._tags_to_add))
|
||||||
|
+ except NullPointerError:
|
||||||
|
+ pass
|
|
@ -1,8 +1,8 @@
|
||||||
# Template file for 'afew'
|
# Template file for 'afew'
|
||||||
pkgname=afew
|
pkgname=afew
|
||||||
version=3.0.1
|
version=3.0.1
|
||||||
revision=7
|
revision=8
|
||||||
build_style=python3-module
|
build_style=python3-pep517
|
||||||
hostmakedepends="python3-setuptools_scm python3-Sphinx pkg-config"
|
hostmakedepends="python3-setuptools_scm python3-Sphinx pkg-config"
|
||||||
depends="notmuch-python3 python3-dkimpy python3-chardet notmuch"
|
depends="notmuch-python3 python3-dkimpy python3-chardet notmuch"
|
||||||
checkdepends="python3-pytest python3-freezegun $depends"
|
checkdepends="python3-pytest python3-freezegun $depends"
|
||||||
|
|
Loading…
Add table
Reference in a new issue