Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onlyAllowTags doesn't support case insensitive tags #190

Closed
Rhababo opened this issue Sep 26, 2023 · 3 comments · Fixed by #191
Closed

onlyAllowTags doesn't support case insensitive tags #190

Rhababo opened this issue Sep 26, 2023 · 3 comments · Fixed by #191
Assignees
Labels
bug Something isn't working P0 Critical Issue

Comments

@Rhababo
Copy link

Rhababo commented Sep 26, 2023

The allowed tags settings doesn't have an option for checking for case sensitivity.

One option to fix this is to add a .toLowerCase() to the isAllowedTag() function in the parser

const isAllowedTag = (value) => {
    if (options.onlyAllowTags && options.onlyAllowTags.length) {
      return options.onlyAllowTags.indexOf(value**.toLowerCase()**) >= 0;
    }

    return true;
  };

toTagNode() already contains a .toLowerCase() statement

toTagNode() {
return new TagNode(this.tag.toLowerCase(), this.attrs, this.content);
}

so all tags get converted to lowercase anyway.

Could we either add .toLowerCase() to the isAllowedTag function, or, if we want block incorrectly cased tags, can we add an option that when flagged allows for case insensitive tags?

@JiLiZART
Copy link
Owner

JiLiZART commented Sep 26, 2023

bbcode like an a html is ignoring case of tags, so i think the parser andonlyAllowTags also should ignore the case of tags. I fix this behavior in next release.

@JiLiZART JiLiZART self-assigned this Sep 26, 2023
@JiLiZART JiLiZART added the bug Something isn't working label Sep 26, 2023
@Mondrethos
Copy link

bbcode like an a html is ignoring case of tags, so i think the parser andonlyAllowTags also should ignore the case of tags. I fix this behavior in next release.

Thanks! Pretty excited for this fix.

@JiLiZART JiLiZART added the P0 Critical Issue label Sep 28, 2023
JiLiZART added a commit that referenced this issue Sep 28, 2023
* fix(preset-html5): add color tag #189

* fix(parser): case insensitive tags bug #190
@JiLiZART
Copy link
Owner

Fixed in 3.0.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working P0 Critical Issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants