mirror of
https://github.com/gchq/CyberChef.git
synced 2025-05-09 07:45:00 -04:00
Minor adjustments
This commit is contained in:
parent
0c5c599150
commit
84ccefa5a4
1 changed files with 3 additions and 3 deletions
|
@ -1,6 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* @author tlwr [toby@toby.codes]
|
* @author tlwr [toby@toby.codes]
|
||||||
* @author Matt C [me@mitt.dev]
|
* @author Matt C [me@mitt.dev]
|
||||||
|
* @author Michael Rowley [michaellrowley@protonmail.com]
|
||||||
* @copyright Crown Copyright 2019
|
* @copyright Crown Copyright 2019
|
||||||
* @license Apache-2.0
|
* @license Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
@ -33,8 +34,6 @@ class HTMLToText extends Operation {
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
run(input, args) {
|
run(input, args) {
|
||||||
// TODO: Add blacklisted tags via args.
|
|
||||||
// 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;
|
||||||
|
@ -43,7 +42,8 @@ class HTMLToText extends Operation {
|
||||||
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] ||
|
||||||
|
tag.split(' ')[0] == 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