Skip to content
This repository has been archived by the owner on Sep 26, 2023. It is now read-only.

Commit

Permalink
Add more HTML escaping
Browse files Browse the repository at this point in the history
  • Loading branch information
joeattardi committed Nov 25, 2021
1 parent dc14b8d commit fe54bef
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/categoryButtons.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { TinyEmitter as Emitter } from 'tiny-emitter';
import escape from 'escape-html';

import { CLASS_CATEGORY_BUTTONS, CLASS_CATEGORY_BUTTON } from './classes';

Expand Down
6 changes: 4 additions & 2 deletions src/emojiArea.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { TinyEmitter as Emitter } from 'tiny-emitter';
import escape from 'escape-html';

import emojiData from './data/emoji';
import { i18n as defaultI18n } from './i18n';
Expand Down Expand Up @@ -297,8 +298,9 @@ export class EmojiArea {
emojis: Array<EmojiRecord | RecentEmoji>
): void => {
const name = createElement('h2', CLASS_CATEGORY_NAME);
name.innerHTML =
this.i18n.categories[category] || defaultI18n.categories[category];
name.innerHTML = escape(
this.i18n.categories[category] || defaultI18n.categories[category]
);
this.emojis.appendChild(name);
this.headers.push(name);

Expand Down
2 changes: 1 addition & 1 deletion src/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export class EmojiPreview {
}

this.emoji.innerHTML = content;
this.name.innerHTML = emoji.name;
this.name.innerHTML = escape(emoji.name);
}

hidePreview(): void {
Expand Down
3 changes: 2 additions & 1 deletion src/search.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { TinyEmitter as Emitter } from 'tiny-emitter';
import escape from 'escape-html';

import * as icons from './icons';

Expand Down Expand Up @@ -40,7 +41,7 @@ class NotFoundMessage {
container.appendChild(iconContainer);

const messageContainer = createElement('h2');
messageContainer.innerHTML = this.message;
messageContainer.innerHTML = escape(this.message);
container.appendChild(messageContainer);

return container;
Expand Down

0 comments on commit fe54bef

Please sign in to comment.