question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Trailing text is not preserved

See original GitHub issue

To Reproduce

  1. Get sample project that demonstrates bug (2 files) from here: https://gist.github.com/IvanPizhenko/100c92f523a994fd425ff8f16420f12d
  2. Run npm install
  3. Run node index.js

Expected behavior

I expect trailing text Above is preserved, i.e. sanitized output should be:

Below
<span>[image: image.png]</span>
Above

Describe the bug

Trailing text Above is lost, i.e. I am getting:

Below
<span>[image: image.png]</span>

Details

Version of Node.js: v12.22.6

Server Operating System: Linux

Additional context: I am trying to upgrade sanitize-html from version 1.21.1 to latest 2.5.2 (at the moment of submitting this issue) and getting the above described issue. According to my research (I have tried multiple versions) bug has appeared in version 1.27.3.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
boutellcommented, Oct 26, 2021

It sounds like it might be an upstream issue with the htmlparser2 module. Might be — haven’t delved into it.

1reaction
tomholubcommented, Oct 26, 2021

Seems to be a regression. Maintainers: could you point us in the right direction as far as any guesses on where to look? We may attempt a fix.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Trailing Whitespace in Comments Not Preserved #17421
Actual behavior: Trailing white space is lost. ... A compiler option to preserve trailing white space within comments in the tsconfig.json would ...
Read more >
Is there a simple way to preserve trailing tabs in java during ...
I'm not alone in trying to preserve whitespace am I? I have a problem with it when it's reading from a file. I...
Read more >
Trailing Blanks in Character String Processing
Trailing blanks are not kept in many positions and that means that a text field literal containing one blank ' ' is often...
Read more >
Re: [csswg-drafts] [css-text][css-sizing] When to/not to ... - Mailing lists
Re: [csswg-drafts] [css-text][css-sizing] When to/not to include preserved trailing spaces (#3440). This message : [ Message body ] [ Respond ] [ More ......
Read more >
Keep trailing spaces in fields after Text To Columns
I am taking a text file which includes spaces in each. ... I would like a fix for all the cells as it...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found