Open dominicbraam opened 2 years ago
okay i might be a ~little~ late but i hope others see it.
export const echo = async (args: string[]): Promise<string> => {
const string = args.join(' ');
const regex = /<(?:(?:(?:(script|style|object|embed|applet|noframes|noscript|noembed)(?:\s+(?:"[\S\s]*?"|'[\S\s]*?'|(?:(?!\/>)[^>])?)+)?\s*>)[\S\s]*?<\/\1\s*(?=>))|(?:\/?[\w:]+\s*\/?)|(?:[\w:]+\s+(?:"[\S\s]*?"|'[\S\s]*?'|[^>]?)+\s*\/?)|\?[\S\s]*?\?|(?:!(?:(?:DOCTYPE[\S\s]*?)|(?:\[CDATA\[[\S\s]*?\]\])|(?:--[\S\s]*?--)|(?:ATTLIST[\S\s]*?)|(?:ENTITY[\S\s]*?)|(?:ELEMENT[\S\s]*?))))>/g;
if (regex.test(string)) {
return "nice try lmao";
}
return string.replace(regex, "");
};
Description
As stated in issue 25, you can insert html tags into the prompt and it will act as intended.
Fix
The replace function was used to replace html tags with "". On linux, by default, it does not parse characters like < and would need to escape it. Example:
For now it is a simple fix but as the other commands have cheesy responses, maybe instead of "removing" the tags and still outputting the text within them, respond with "Nice try!" ?
Closes: #25