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

html_safe being called when it shouldn't #1

Closed
ghost opened this issue Jun 11, 2010 · 1 comment
Closed

html_safe being called when it shouldn't #1

ghost opened this issue Jun 11, 2010 · 1 comment

Comments

@ghost
Copy link

ghost commented Jun 11, 2010

A snippet from textilize method, note that html_safe is being called on the return value of the if block. Which means it will be called even if "" is returned, which is unnecessary.

  if text.blank?
    ""
  else
    textilized = RedCloth.new(text, options)
    textilized.to_html
  end.html_safe
@dtrasbo
Copy link
Owner

dtrasbo commented Jun 11, 2010

That is the desired behavior. If we don't call html_safe on the blank string it will be sanitized, which is unnecessary because the string obviously is safe.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant