Skip to content

Unescape HTML tags being skipped during unescapeHtmlTags() #45

@mfathy

Description

@mfathy

SW details (please complete the following information):

  • IDE version: [IntelliJ IDEA 2021.2.1 (Community Edition)
    Build #IC-212.5080.55, built on August 24, 2021]
  • Plug-in Version 2.0.0 - 2.4.0

Summary and background of the bug
Having a string like the following in POEditor:

<![CDATA[ <br /> <p><a href="mailto:xyz@abc.com">ABC Email</a></p> ]]> 

Makes the plugin to crash and never download the strings.

Steps to reproduce
Steps to reproduce the behaviour:

  1. Create a string with the above string in your POEditor project
  2. Try to sycn the string
  3. See error
> org.xml.sax.SAXParseException; lineNumber: 147; columnNumber: 235; The element type "p" must be terminated by the matching end-tag "</p>". 

I followed the exception and found that
String.unescapeHtmlTags() doesn't do its job of replaces all html tags, mostly it will fail to replace
**&lt;a href="mailto:xyz@abc.com"&gt;**ABC Email</a>

so I used this piece of code to fix the issue locally instead of changing the regex used:

fun String.unescapeHtmlTags(): String { return this.replace("&lt;", "<").replace("&gt;", ">") } 

and it's working very well now.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions