[MGNLSTK-1366] Allow query parameters to be used in redirect template Created: 05/Mar/14 Updated: 29/Sep/14 Resolved: 17/Sep/14 |
|
| Status: | Closed |
| Project: | Magnolia Standard Templating Kit (closed) |
| Component/s: | None |
| Affects Version/s: | 2.7.2 |
| Fix Version/s: | 2.7.9, 2.8.4 |
| Type: | Bug | Priority: | Neutral |
| Reporter: | Richard Gange | Assignee: | Christopher Zimmermann |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | support | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||
| Template: |
|
||||||||||||||||
| Acceptance criteria: |
Empty
|
||||||||||||||||
| Release notes required: |
Yes
|
||||||||||||||||
| Date of First Response: | |||||||||||||||||
| Description |
|
The redirect template should allow for query parameters in the path property. The issue right now is that the '&' character is being encoded to & Steps to reproduce: |
| Comments |
| Comment by Richard Gange [ 05/Mar/14 ] |
|
I was able to solve the issue by unescaping html on the redirectTo variable on line 114. Like this: webContext.getResponse().sendRedirect(StringEscapeUtils.unescapeHtml(redirectTo)); This seems to completely fixes the external link but the internal link needs some additional changes in the ftl to handle the query parameters. Since in the ftl we check to see that a content node exists for the provided path. The addition of the query parameters on the end of the path will break the check. |
| Comment by Richard Gange [ 10/Mar/14 ] |
|
Christian has suggested a solution that only involves changing the template script. See SUPPORT-3307. |
| Comment by Christopher Zimmermann [ 10/Sep/14 ] |
|
Update RedirectTemplateModel to pay attention to querystrings - the most important thing being to call EscapeUtil.unescapeXss on the redirect url's so that the & in a querystring gets converted back to &, etc. Additionally support querystring in internal links by improving getRedirectPathToInternalContent to strip the querystring off before checking if the node exists. |