[FIX] Link preview containing HTML encoded chars (#16512)

pull/15932/head
gabriellsh 6 years ago committed by GitHub
parent 2503fa4428
commit 68d25770cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      app/oembed/client/oembedUrlWidget.html
  2. 5
      app/oembed/client/oembedUrlWidget.js

@ -25,7 +25,7 @@
<a href="{{url}}" rel="noopener noreferrer" target="{{target}}"><strong>{{{title}}}</strong></a>
</div>
{{/if}}
<div style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis">{{{description}}}</div>
<div style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis">{{description}}</div>
</div>
</blockquote>
{{/if}}

@ -1,6 +1,7 @@
import { Blaze } from 'meteor/blaze';
import { Template } from 'meteor/templating';
import _ from 'underscore';
import s from 'underscore.string';
const getTitle = function(self) {
if (self.meta == null) {
@ -17,14 +18,14 @@ const getDescription = function(self) {
if (description == null) {
return;
}
return _.unescape(description.replace(/(^[“\s]*)|([”\s]*$)/g, ''));
return s.unescapeHTML(description.replace(/(^[“\s]*)|([”\s]*$)/g, ''));
};
Template.oembedUrlWidget.helpers({
description() {
const description = getDescription(this);
if (_.isString(description)) {
return Blaze._escape(description);
return description;
}
},
title() {

Loading…
Cancel
Save