mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-03 21:43:21 +00:00 
			
		
		
		
	linkifiers: Support URL percent-encoded bytes.
Supporting URL percent-encoded bytes is possible using `%%20`, but this is not necessarily very understandable to end-users, even those that understand percent encoding. Allow `%20` in linkifier URL format strings, and transform them into `%%20` in the pattern just before they are applied in markdown translation. Care must be taken here, such that already-escaped `%`s are not escaped an extra time. We do this before rendering, and not before storage, as a simplification; the JS-side linkifier at present only understands `%(foo)s` and thus needs no changes, and to avoid an un-escaping pass before showing in the admin UI.
This commit is contained in:
		
				
					committed by
					
						
						Tim Abbott
					
				
			
			
				
	
			
			
			
						parent
						
							d6768814a1
						
					
				
				
					commit
					9381a3bd45
				
			@@ -1138,6 +1138,9 @@ def filter_format_validator(value: str) -> None:
 | 
			
		||||
                  \( [a-zA-Z0-9_-]+ \) s  #   Interpolation group
 | 
			
		||||
                |                         #     OR
 | 
			
		||||
                  %                       #   %%, which is an escaped %
 | 
			
		||||
                |                         #     OR
 | 
			
		||||
                  [0-9a-fA-F][0-9a-fA-F]  #   URL percent-encoded bytes, which we
 | 
			
		||||
                                          #   special-case in markdown translation
 | 
			
		||||
                )
 | 
			
		||||
            )+                            # Those happen one or more times
 | 
			
		||||
            $
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user