freemarker-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel Dekany (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (FREEMARKER-16) js_string buit-in function escapes '/' for first character
Date Mon, 14 Mar 2016 14:39:33 GMT

    [ https://issues.apache.org/jira/browse/FREEMARKER-16?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15193373#comment-15193373
] 

Daniel Dekany edited comment on FREEMARKER-16 at 3/14/16 2:38 PM:
------------------------------------------------------------------

I have fixed the documentation (will be visible when 2.3.24 is released). As of escaping for
generating JSP, that can only be part of FreeMarker if it works in all cases, and of course
it's more complex than escaping {{'}} and {{"}}. Like it has to escape {{${}} and {{#{}} too,
and it must not generate escapes like {{\n}}, which doesn't exist in JSP. But the trickier
part is with {{& quot;}} and {{& amp;}} (the extra space after the {{&}} is there
because I can't escape them into Jira either... funny), which are alternative ways of escaping
{{'}} and {{"}}, however they themselves can't be escaped. So if you have {{$\{s?jsp_string}}},
and {{s}} contains {{& quot;}}, the only way I can escape it is with EL: {{$\{'&'}quot;}}.
Kind of insane...


was (Author: ddekany):
I have fixed the documentation (will be visible when 2.3.24 is released). As of escaping for
generating JSP, that can only be part of FreeMarker if it works in all cases, and of course
it's more complex than escaping {{'}} and {{"}}. Like it has to escape {{${}} and {{#{}} too,
and is must generate escapes like {{\n}}, which doesn't exist in JSP. But the trickier part
is with {{& quot;}} and {{& amp;}} (the extra space after the {{&}} is there because
I can't escape them into Jira either... funny), which are alternative ways of escaping {{'}}
and {{"}}, however they themselves can't be escaped. So if you have {{$\{s?jsp_string}}},
and {{s}} contains {{& quot;}}, the only way I can escape it is with EL: {{$\{'&'}quot;}}.
Kind of insane...

> js_string buit-in function escapes '/' for first character
> ----------------------------------------------------------
>
>                 Key: FREEMARKER-16
>                 URL: https://issues.apache.org/jira/browse/FREEMARKER-16
>             Project: Apache Freemarker
>          Issue Type: Bug
>          Components: engine
>    Affects Versions: 2.3.23
>            Reporter: Martin Těthal
>            Priority: Minor
>
> ${"bar/foo"?js_string} returns "bar/foo"
> but
> ${"/foo"?js_string} returns "\/foo" (the first slash character is escaped by backslash).
> I think the problem is from version 2.3.1 as documentation says:
> Starting from FreeMarker 2.3.1, it also escapes > as \> (to avoid </script>).



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message