" in my Rails application I am having a strange problem where the user can enter the following text ...">

The string "Test" <3 "appears as" Test "<3>" in my Rails application

I am having a strange problem where the user can enter the following text

Test '<3'

and displayed as

Test '<3>

In the output, I use white_list, and the value stored in the database:

'testing' '<3' ''

Which can make the conclusion consider it a tag and tries to close it (this is what it seems to me).

Thanks!

+3
source share
1 answer

Ruby, &, < @ . "h" .rhtml.

<strong><%= h("This is a quick Test'<3'.") %></strong>

:

<strong>This is a quick Test'&lt;3'.</strong>

, :

'< 3'.

( Ruby, !)

+2

Source: https://habr.com/ru/post/1710716/


All Articles