mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 16:40:24 +08:00 
			
		
		
		
	Render email addresses as such if followed by punctuation (#27987)
Added the following characters to the regular expression for the email: - , - ; - ? - ! Also added a test case. - Fixes #27616 # Before  # After  Signed-off-by: Yarden Shoham <git@yardenshoham.com>
This commit is contained in:
		@@ -264,6 +264,18 @@ func TestRender_email(t *testing.T) {
 | 
			
		||||
		"send email to info@gitea.co.uk.",
 | 
			
		||||
		`<p>send email to <a href="mailto:info@gitea.co.uk" rel="nofollow">info@gitea.co.uk</a>.</p>`)
 | 
			
		||||
 | 
			
		||||
	test(
 | 
			
		||||
		`j.doe@example.com,
 | 
			
		||||
	j.doe@example.com.
 | 
			
		||||
	j.doe@example.com;
 | 
			
		||||
	j.doe@example.com?
 | 
			
		||||
	j.doe@example.com!`,
 | 
			
		||||
		`<p><a href="mailto:j.doe@example.com" rel="nofollow">j.doe@example.com</a>,<br/>
 | 
			
		||||
<a href="mailto:j.doe@example.com" rel="nofollow">j.doe@example.com</a>.<br/>
 | 
			
		||||
<a href="mailto:j.doe@example.com" rel="nofollow">j.doe@example.com</a>;<br/>
 | 
			
		||||
<a href="mailto:j.doe@example.com" rel="nofollow">j.doe@example.com</a>?<br/>
 | 
			
		||||
<a href="mailto:j.doe@example.com" rel="nofollow">j.doe@example.com</a>!</p>`)
 | 
			
		||||
 | 
			
		||||
	// Test that should *not* be turned into email links
 | 
			
		||||
	test(
 | 
			
		||||
		"\"info@gitea.com\"",
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user