kenny-hybris / urlrewritefilter

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

Variables containing non-alphanumeric characters are not recognized #122

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago

Steps to reproduce:
1. Create a rule whose <to> property contains a variable such as 
%{session-attribute:com.example.ATTRIBUTE_NAME}.
2. Visit a URL that triggers the rule.

Expected result:
The variable in the <to> property (${...}) is replaced with the actual contents 
of the session attribute "com.example.ATTRIBUTE_NAME".

Actual result:
The variable expression, "%{session-attribute:com.example.ATTRIBUTE_NAME}", is 
included in the URL verbatim (after being URL-encoded).

Cause:
The toVariablePattern field in the VariableReplacer class uses the following 
pattern to recognize variables: (?<!\\)%\{([-a-zA-Z:]*)\}
However, session attributes can (and often do) contain characters other than 
a-z, :, and -.

Tested with version: 4.0.3

Original issue reported on code.google.com by br...@control-v.net on 26 Sep 2012 at 8:54

GoogleCodeExporter commented 9 years ago
Also, I realized that (despite the title I used for the issue) numerics aren't 
recognized either.

Original comment by br...@control-v.net on 26 Sep 2012 at 9:19

GoogleCodeExporter commented 9 years ago
I came across this bug, "%{parameter:session_id}" is not recognized as 
variables, however, "_" is valid as parameter name.

Original comment by lamsh...@gmail.com on 25 Jan 2013 at 5:46

GoogleCodeExporter commented 9 years ago
FYI, back in version 3.2.0 the pattern was "(?<!\\\\)%\\{(.*?)\\}" 

Original comment by lamsh...@gmail.com on 25 Jan 2013 at 5:47