mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 14:03:30 +00:00 
			
		
		
		
	email-mirror: Support '.' as an alternate for '+' (and bugfix).
Google Groups won't let you add an email address that has a '+' in it as a member of a group, so we allow '.' as well. This commit also fixes a current issue with email mirroring, where it doesn't work if you had a + in the stream name. This fixes Trac #2102. (imported from commit 9a7a5f5d16087f6f74fb5308e170a6f04387599e)
This commit is contained in:
		@@ -1720,9 +1720,15 @@ def decode_email_address(email):
 | 
				
			|||||||
    if not match:
 | 
					    if not match:
 | 
				
			||||||
        return None
 | 
					        return None
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    token = match.group(1)
 | 
					    full_address = match.group(1)
 | 
				
			||||||
    decoded_token = re.sub("%\d{4}", lambda x: unichr(int(x.group(0)[1:])), token)
 | 
					    if '.' in full_address:
 | 
				
			||||||
    return decoded_token.split('+')
 | 
					        # Workaround for Google Groups and other programs that don't accept emails
 | 
				
			||||||
 | 
					        # that have + signs in them (see Trac #2102)
 | 
				
			||||||
 | 
					        encoded_stream_name, token = full_address.split('.')
 | 
				
			||||||
 | 
					    else:
 | 
				
			||||||
 | 
					        encoded_stream_name, token = full_address.split('+')
 | 
				
			||||||
 | 
					    stream_name = re.sub("%\d{4}", lambda x: unichr(int(x.group(0)[1:])), encoded_stream_name)
 | 
				
			||||||
 | 
					    return stream_name, token
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# In general, it's better to avoid using .values() because it makes
 | 
					# In general, it's better to avoid using .values() because it makes
 | 
				
			||||||
# the code pretty ugly, but in this case, it has significant
 | 
					# the code pretty ugly, but in this case, it has significant
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user