Shopify / Shopify/liquid

Incorrect remove newlines if use filter newlines_to_br

Open
#1,196 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
11.9k
Forks
1.5k
Avg merge
17h 55m
Merged PRs (30d)
3

Description

If you use the filter newline_to_br you are not cleaning correctly the CLFR as is done in strip_newlines

Its recomended to change line https://github.com/Shopify/liquid/blob/e83b1e415990894c9517f94a8c2020ff825da027/lib/liquid/standardfilters.rb#L298

to:

input.to_s.gsub(/\r?\n/, '<br />')

This will remove strange carriage character ^M

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Inspect lib/liquid/standardfilters.rb at the referenced line and compare newline_to_br with strip_newlines. Verify the filter's handling of carriage returns in CRLF input; done means it no longer leaves a stray ^M character.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
web-dev
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.