mirror of
				https://github.com/cinnyapp/cinny.git
				synced 2025-11-04 14:30:29 +03:00 
			
		
		
		
	Fix incorrect custom html crashing app (#429)
Signed-off-by: Ajay Bura <ajbura@gmail.com>
This commit is contained in:
		
							parent
							
								
									30f8930773
								
							
						
					
					
						commit
						9cb13a91cd
					
				
					 1 changed files with 11 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -186,9 +186,17 @@ const MessageBody = React.memo(({
 | 
			
		|||
  // if body is not string it is a React element.
 | 
			
		||||
  if (typeof body !== 'string') return <div className="message__body">{body}</div>;
 | 
			
		||||
 | 
			
		||||
  let content = isCustomHTML
 | 
			
		||||
    ? twemojify(sanitizeCustomHtml(body), undefined, true, false)
 | 
			
		||||
    : twemojify(body, undefined, true);
 | 
			
		||||
  let content = null;
 | 
			
		||||
  if (isCustomHTML) {
 | 
			
		||||
    try {
 | 
			
		||||
      content = twemojify(sanitizeCustomHtml(body), undefined, true, false);
 | 
			
		||||
    } catch {
 | 
			
		||||
      console.error('Malformed custom html: ', body);
 | 
			
		||||
      content = twemojify(body, undefined);
 | 
			
		||||
    }
 | 
			
		||||
  } else {
 | 
			
		||||
    content = twemojify(body, undefined, true);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // Determine if this message should render with large emojis
 | 
			
		||||
  // Criteria:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue