home » zplus/clif.git
Author zPlus <zplus@peers.community> 2023-03-21 21:27:47
Committer zPlus <zplus@peers.community> 2023-03-21 21:27:47
Commit 3dfb528 (patch)
Tree 03252d7
Parent(s)

Check for email body length on (un-)subscription request.


commits diff: 64641d0..3dfb528
1 file changed, 4 insertions, 4 deletionsdownload


Diffstat
-rwxr-xr-x emails.py 8

Diff options
View
Side
Whitespace
Context lines
Inter-hunk lines
+4/-4 M   emails.py
index fea03fb..a7db528
old size: 11K - new size: 11K
@@ -136,8 +136,8 @@ except:
136 136 ###############################################################################
137 137
138 138 # Is this a request for subscription?
139 - request_subscribe = email_subject.upper('SUBSCRIBE')
140 - request_unsubscribe = email_subject.upper('UNSUBSCRIBE')
139 + request_subscribe = email_subject.upper('SUBSCRIBE') and len(email_body) == 0
140 + request_unsubscribe = email_subject.upper('UNSUBSCRIBE') and len(email_body) == 0
141 141
142 142 if request_subscribe:
143 143 # Already subscribed?
@@ -148,7 +148,7 @@ if request_subscribe:
148 148 subscribers.append(email_from[1])
149 149 commit_message = 'Subscribe'
150 150
151 - if request_unsubscribe
151 + if request_unsubscribe:
152 152 # Already unsubscribed?
153 153 if email_from[1] not in subscribers:
154 154 logging.info('{} already unsubscribed from {}'.format(email_from, repository_path))
@@ -192,7 +192,7 @@ if request_subscribe or request_unsubscribe:
192 192 # for the thread. Otherwise, we will create a new tree.
193 193 ###############################################################################
194 194
195 - if not email_body or len(email_body) == 0:
195 + if len(email_body) == 0:
196 196 logging.info('Refuting email without plaintext body: {}'.format(email_subject))
197 197 exit()
198 198