Skip to content

Commit

Permalink
fix url sanitization
Browse files Browse the repository at this point in the history
  • Loading branch information
slugalisk committed Dec 3, 2023
1 parent 7cf5d36 commit ffebf1e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions assets/chat/js/formatters.js
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,7 @@ class UrlFormatter {
url = self.encodeUrl(tm[0]);
const href = scheme + url;
if (tm) {
const embedHref = `${NITTER_URL}/${tm[1]}`;
const embedHref = `${NITTER_URL}/${self.encodeUrl(tm[1])}`;
return `<a target="_blank" class="embed-internallink ${extraclass}" href="${embedHref}">${embedHref}</a><a target="_blank" class="embed-externallink" href="${href}" rel="nofollow" title="${url}"></a>`;
}
}
Expand All @@ -737,7 +737,7 @@ class UrlFormatter {
const sub = this.embedSubstitutions[i];
const sm = decodedUrl.match(sub.pattern);
if (sm) {
const embed = sub.template(sm[1]);
const embed = self.encodeUrl(sub.template(sm[1]));
const embedHref = `${RUSTLA_URL}/${embed}`;
return `<a target="_blank" class="embed-internallink ${extraclass}" href="${embedHref}">${embed}</a><a target="_blank" class="embed-externallink" href="${href}" rel="nofollow" title="${url}"></a>`;
}
Expand Down

0 comments on commit ffebf1e

Please sign in to comment.