Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit c887772

Browse files
Update dependency html-entities to v2 (#9697)
* Update dependency html-entities to v2 * Update dependency html-entities to v2 * Update imports Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
1 parent eca1eb1 commit c887772

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
"gfm.css": "^1.1.2",
8484
"glob-to-regexp": "^0.4.1",
8585
"highlight.js": "^11.3.1",
86-
"html-entities": "^1.4.0",
86+
"html-entities": "^2.0.0",
8787
"is-ip": "^3.1.0",
8888
"jszip": "^3.7.0",
8989
"katex": "^0.12.0",

src/HtmlUtils.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import classNames from 'classnames';
2424
import EMOJIBASE_REGEX from 'emojibase-regex';
2525
import { split } from 'lodash';
2626
import katex from 'katex';
27-
import { AllHtmlEntities } from 'html-entities';
27+
import { decode } from 'html-entities';
2828
import { IContent } from 'matrix-js-sdk/src/models/event';
2929
import { Optional } from 'matrix-events-sdk';
3030

@@ -518,7 +518,7 @@ export function bodyToHtml(content: IContent, highlights: Optional<string[]>, op
518518
// Cheerio instance to be returned.
519519
phtml('div, span[data-mx-maths!=""]').replaceWith(function(i, e) {
520520
return katex.renderToString(
521-
AllHtmlEntities.decode(phtml(e).attr('data-mx-maths')),
521+
decode(phtml(e).attr('data-mx-maths')),
522522
{
523523
throwOnError: false,
524524
// @ts-ignore - `e` can be an Element, not just a Node

src/components/views/rooms/LinkPreviewWidget.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ limitations under the License.
1515
*/
1616

1717
import React, { ComponentProps, createRef } from 'react';
18-
import { AllHtmlEntities } from 'html-entities';
18+
import { decode } from 'html-entities';
1919
import { MatrixEvent } from 'matrix-js-sdk/src/models/event';
2020
import { IPreviewUrlResponse } from 'matrix-js-sdk/src/client';
2121

@@ -124,7 +124,7 @@ export default class LinkPreviewWidget extends React.Component<IProps> {
124124

125125
// The description includes &-encoded HTML entities, we decode those as React treats the thing as an
126126
// opaque string. This does not allow any HTML to be injected into the DOM.
127-
const description = AllHtmlEntities.decode(p["og:description"] || "");
127+
const description = decode(p["og:description"] || "");
128128

129129
const title = p["og:title"]?.trim() ?? "";
130130
const anchor = <a href={this.props.link} target="_blank" rel="noreferrer noopener">{ title }</a>;

src/editor/serialize.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ See the License for the specific language governing permissions and
1515
limitations under the License.
1616
*/
1717

18-
import { AllHtmlEntities } from 'html-entities';
18+
import { encode } from 'html-entities';
1919
import cheerio from 'cheerio';
2020
import escapeHtml from "escape-html";
2121

@@ -117,7 +117,7 @@ export function htmlSerializeFromMdIfNeeded(md: string, { forceHTML = false } =
117117
patternDefaults[patternName][patternType];
118118

119119
md = md.replace(RegExp(pattern, "gms"), function(m, p1, p2) {
120-
const p2e = AllHtmlEntities.encode(p2);
120+
const p2e = encode(p2);
121121
switch (patternType) {
122122
case "display":
123123
return `${p1}<div data-mx-maths="${p2e}">\n\n</div>\n\n`;

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4997,10 +4997,10 @@ html-encoding-sniffer@^3.0.0:
49974997
dependencies:
49984998
whatwg-encoding "^2.0.0"
49994999

5000-
html-entities@^1.4.0:
5001-
version "1.4.0"
5002-
resolved "https://registry.yarnpkg.com/html-entities/-/html-entities-1.4.0.tgz#cfbd1b01d2afaf9adca1b10ae7dffab98c71d2dc"
5003-
integrity sha512-8nxjcBcd8wovbeKx7h3wTji4e6+rhaVuPNpMqwWgnHh+N9ToqsCs6XztWRBPQ+UtzsoMAdKZtUENoVzU/EMtZA==
5000+
html-entities@^2.0.0:
5001+
version "2.3.3"
5002+
resolved "https://registry.yarnpkg.com/html-entities/-/html-entities-2.3.3.tgz#117d7626bece327fc8baace8868fa6f5ef856e46"
5003+
integrity sha512-DV5Ln36z34NNTDgnz0EWGBLZENelNAtkiFA4kyNOG2tDI6Mz1uSWiq1wAKdyjnJwyDiDO7Fa2SO1CTxPXL8VxA==
50045004

50055005
html-escaper@^2.0.0:
50065006
version "2.0.2"

0 commit comments

Comments
 (0)