Open tmerr opened 9 years ago
Type http://@test.com or http://@wat.png into chat. Both render as garbled html.
http://@test.com
http://@wat.png
In firefox, the former displays as @test.com" class="autolink" target="_blank">http://@test.com
@test.com" class="autolink" target="_blank">http://@test.com
The latter displays as @wat.png" class="autolink" target="_blank">@wat.png" alt="http://@wat.png" onload="Dubtrack.room.chat.scollBottomChat();" onerror="Dubtrack.helpers.image.imageError(this, '/assets/images/media/chat_image_load_error.png');Dubtrack.room.chat.scollBottomChat();" />
@wat.png" class="autolink" target="_blank">@wat.png" alt="http://@wat.png" onload="Dubtrack.room.chat.scollBottomChat();" onerror="Dubtrack.helpers.image.imageError(this, '/assets/images/media/chat_image_load_error.png');Dubtrack.room.chat.scollBottomChat();" />
See chatItem.view.js lines 12 and 13:
this.model.set( 'message', Dubtrack.helpers.text.convertHtmltoTags( this.model.get('message'), "Dubtrack.room.chat.scollBottomChat();" )); this.model.set( 'message', Dubtrack.helpers.text.convertAttoLink( this.model.get('message') ));
convertHtmltoTags turns the link into a <a href=.... So far so good. Then convertAttoLink plugs html tags within that and breaks everything.
<a href=...
Make @mentions delimited by spaces. Something like
convertAttoLink = function(text){ return text.replace(/(^|[\s\r\n])(@[A-Za-z0-9_.]+)/g, '$1<span class="username-handle">$2&</span>'); }
http://@:kappa:.com
UPDATE: As of right now in beta both links straight up don't work. Only the mention gets converted. In the case of https://test@wat.com the link works correctly.
https://test@wat.com
Issue
Type
http://@test.com
orhttp://@wat.png
into chat. Both render as garbled html.In firefox, the former displays as
@test.com" class="autolink" target="_blank">http://@test.com
The latter displays as
@wat.png" class="autolink" target="_blank">@wat.png" alt="http://@wat.png" onload="Dubtrack.room.chat.scollBottomChat();" onerror="Dubtrack.helpers.image.imageError(this, '/assets/images/media/chat_image_load_error.png');Dubtrack.room.chat.scollBottomChat();" />
Cause
See chatItem.view.js lines 12 and 13:
convertHtmltoTags turns the link into a
<a href=...
. So far so good. Then convertAttoLink plugs html tags within that and breaks everything.Possible Fix
Make @mentions delimited by spaces. Something like