kenny-hybris / urlrewritefilter

Automatically exported from code.google.com/p/urlrewritefilter
Other
0 stars 0 forks source link

$amp; in ${REPLACEFIRST leaves amp; behind #140

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I have the following urls
download.action?nodePath=%2FNational+Info+Pages%2FBulgaria%2F5.+RESOURCES%2F5.1.
+Legislation%2FCombating+Trafficking+Act_2004+Bulgaria_en.pdf&fileType=pdf&fileN
ame=Combating+Trafficking+Act_2004+Bulgaria_en.pdf

I create the outgoing rule
<outbound-rule>
   <from>download(?:\.action)?\?nodePath=(.+)$</from>
   <to  last="true">d${replaceFirst:$1:&amp;:?}</to>
</outbound-rule>

The outcome is
http://localhost:8080/at-fo-2.1.4/d/National+Info+Pages/Bulgaria/5.+RESOURCES/5.
1.+Legislation/Combating+Trafficking+Act_2004+Bulgaria_en.pdf?amp;fileType=pdf&f
ileName=Combating+Trafficking+Act_2004+Bulgaria_en.pdf

I expected to get
http://localhost:8080/at-fo-2.1.4/d/National+Info+Pages/Bulgaria/5.+RESOURCES/5.
1.+Legislation/Combating+Trafficking+Act_2004+Bulgaria_en.pdf?fileType=pdf&fileN
ame=Combating+Trafficking+Act_2004+Bulgaria_en.pdf

I use version 
4.0.3

I think a more reasonable way of treating ampersands should be found. Since you 
use xml for the rules, try to decode the <to> from xml to java string before 
using it. At least translate any entities.

Original issue reported on code.google.com by georg...@gmail.com on 8 May 2013 at 9:03