Skip to content

Commit

Permalink
fix: safer </script> regexes (#835)
Browse files Browse the repository at this point in the history
  • Loading branch information
tivac authored Apr 9, 2022
1 parent 8b4bf68 commit ca589f6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/svelte/link.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const isUrl = require("is-url");
const { replaceTrailingNewlines } = require("./replacer.js");

const linkRegex = /<link\b[^<>]*?\bhref=\s*(?:"([^"]+)"|'([^']+)'|([^>\s]+))[^>]*>/gm;
const scriptRegex = /<script[\S\s]*?>([\S\s]*?)<\/script>/im;
const scriptRegex = /<script[^>]*?>([\S\s]*?)<\/script[^>]*?>/im;

// eslint-disable-next-line max-statements
exports.extractLink = async ({
Expand Down
2 changes: 1 addition & 1 deletion packages/svelte/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const { init, parse } = require("es-module-lexer");
const parseImports = require("parse-es6-imports");

const scriptRegex = /<script[\S\s]*?>(?<contents>[\S\s]*?)<\/script>/gim;
const scriptRegex = /<script[^>]*?>(?<contents>[\S\s]*?)<\/script[^>]*?>/gim;

// eslint-disable-next-line max-statements
exports.extractImport = async ({
Expand Down

0 comments on commit ca589f6

Please sign in to comment.