mirror of
https://github.com/gchq/CyberChef.git
synced 2025-05-09 15:55:01 -04:00
Fixed errors
This commit is contained in:
parent
5673c11c5d
commit
0c5c599150
1 changed files with 4 additions and 4 deletions
|
@ -36,14 +36,14 @@ class HTMLToText extends Operation {
|
||||||
// TODO: Add blacklisted tags via args.
|
// TODO: Add blacklisted tags via args.
|
||||||
// TODO: Extract from HTML comments.
|
// TODO: Extract from HTML comments.
|
||||||
let output = "";
|
let output = "";
|
||||||
const blacklistedTags = [ "script", "style" ];
|
const blacklistedTags = ["script", "style"];
|
||||||
const tagRegex = /<\w+>[\s?!\-_().,\/#{}*"£$%^&;:a-z]*/gis;
|
const tagRegex = /<\w+>[\s?!\-_().,/#{}*"£$%^&;:a-z]*/gis;
|
||||||
const tagMatches = input.match(tagRegex);
|
const tagMatches = input.match(tagRegex);
|
||||||
tagMatches.forEach((iterativeMatch) => {
|
tagMatches.forEach((iterativeMatch) => {
|
||||||
const closingTagOffset = iterativeMatch.indexOf('>');
|
const closingTagOffset = iterativeMatch.indexOf(">");
|
||||||
const tag = iterativeMatch.substring(1, closingTagOffset);
|
const tag = iterativeMatch.substring(1, closingTagOffset);
|
||||||
for (let i = 0; i < blacklistedTags.length; i++) {
|
for (let i = 0; i < blacklistedTags.length; i++) {
|
||||||
if (tag == blacklistedTags[i]) {
|
if (tag === blacklistedTags[i]) {
|
||||||
return; // This is why a forEach(...) loop couldn't be used for this nested one.
|
return; // This is why a forEach(...) loop couldn't be used for this nested one.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue