@@ -302,6 +302,42 @@ describe('MessageTextComponent', () => {
302302 ) ;
303303 } ) ;
304304
305+ it ( 'should not double-prefix URLs with uppercase or mixed-case schemes' , ( ) => {
306+ component . message = {
307+ text : 'This is a message with a link HTTPS://example.com' ,
308+ } as any as StreamMessage ;
309+ component . ngOnChanges ( { message : { } as SimpleChange } ) ;
310+
311+ expect ( component . messageTextParts ! [ 0 ] . content ) . toContain (
312+ '<a href="HTTPS://example.com" target="_blank" rel="nofollow">HTTPS://example.com</a>'
313+ ) ;
314+ expect ( component . messageTextParts ! [ 0 ] . content ) . not . toContain (
315+ 'https://HTTPS://example.com'
316+ ) ;
317+
318+ component . message . text =
319+ 'This is a message with a link Https://example.com' ;
320+ component . ngOnChanges ( { message : { } as SimpleChange } ) ;
321+
322+ expect ( component . messageTextParts ! [ 0 ] . content ) . toContain (
323+ '<a href="Https://example.com" target="_blank" rel="nofollow">Https://example.com</a>'
324+ ) ;
325+
326+ component . message . text = 'This is a message with a link FTP://example.com' ;
327+ component . ngOnChanges ( { message : { } as SimpleChange } ) ;
328+
329+ expect ( component . messageTextParts ! [ 0 ] . content ) . toContain (
330+ '<a href="FTP://example.com" target="_blank" rel="nofollow">FTP://example.com</a>'
331+ ) ;
332+
333+ component . message . text = 'This is a message with a link example.com' ;
334+ component . ngOnChanges ( { message : { } as SimpleChange } ) ;
335+
336+ expect ( component . messageTextParts ! [ 0 ] . content ) . toContain (
337+ '<a href="https://example.com" target="_blank" rel="nofollow">example.com</a>'
338+ ) ;
339+ } ) ;
340+
305341 it ( 'should replace URL links inside text content - custom link renderer' , ( ) => {
306342 const service = TestBed . inject ( MessageService ) ;
307343 service . customLinkRenderer = ( url ) =>
0 commit comments