summaryrefslogtreecommitdiff
path: root/Mailman/Gui/ContentFilter.py
diff options
context:
space:
mode:
authorbwarsaw2002-10-07 21:14:37 +0000
committerbwarsaw2002-10-07 21:14:37 +0000
commit073d8fd9f808eda7e8fee21934165d9ae99d4e39 (patch)
treeafe90b9df2a09c1ece433559d19f65627e86eb79 /Mailman/Gui/ContentFilter.py
parent790b8101e19a22ed9aa796fc840785b81f535d2c (diff)
downloadmailman-073d8fd9f808eda7e8fee21934165d9ae99d4e39.tar.gz
mailman-073d8fd9f808eda7e8fee21934165d9ae99d4e39.tar.zst
mailman-073d8fd9f808eda7e8fee21934165d9ae99d4e39.zip
Diffstat (limited to 'Mailman/Gui/ContentFilter.py')
-rw-r--r--Mailman/Gui/ContentFilter.py18
1 files changed, 16 insertions, 2 deletions
diff --git a/Mailman/Gui/ContentFilter.py b/Mailman/Gui/ContentFilter.py
index d4eb0b8db..7d66934b8 100644
--- a/Mailman/Gui/ContentFilter.py
+++ b/Mailman/Gui/ContentFilter.py
@@ -76,7 +76,10 @@ class ContentFilter(GUIBase):
e.g. <tt>image/gif</tt>. Leave off the subtype to remove all
parts with a matching major content type, e.g. <tt>image</tt>.
- <p>Blank lines are ignored.""")),
+ <p>Blank lines are ignored.
+
+ <p>See also <a href="?VARHELP=contentfilter/pass_mime_types"
+ >pass_mime_types</a> for a content type whitelist.""")),
('pass_mime_types', mm_cfg.Text, (10, WIDTH), 0,
_("""Remove message attachments that don't have a matching
@@ -103,7 +106,18 @@ class ContentFilter(GUIBase):
if property in ('filter_mime_types', 'pass_mime_types'):
types = []
for spectype in [s.strip() for s in val.splitlines()]:
- if 0 > spectype.count('/') > 1:
+ ok = 1
+ slashes = spectype.count('/')
+ if slashes == 0 and not spectype:
+ ok = 0
+ elif slashes == 1:
+ maintype, subtype = [s.strip().lower()
+ for s in spectype.split('/')]
+ if not maintype or not subtype:
+ ok = 0
+ elif slashes > 1:
+ ok = 0
+ if not ok:
doc.addError(_('Bad MIME type ignored: %(spectype)s'))
else:
types.append(spectype.strip().lower())