[MGNLSTK-551] External links do not allow any other protocol than http Created: 23/Dec/09 Updated: 23/Jan/13 Resolved: 27/Oct/10 |
|
| Status: | Closed |
| Project: | Magnolia Standard Templating Kit (closed) |
| Component/s: | None |
| Affects Version/s: | 1.1.2 |
| Fix Version/s: | 1.3.6, 1.4 |
| Type: | Bug | Priority: | Major |
| Reporter: | Andreas Weder (MP) (Inactive) | Assignee: | Ondrej Chytil |
| Resolution: | Fixed | Votes: | 1 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
any |
||
| Attachments: |
|
| Template: |
|
| Patch included: |
Yes
|
| Acceptance criteria: |
Empty
|
| Date of First Response: |
| Description |
|
If you enter any external link with a protocol different from http, the string "http://" is prepended to it. This is due to STKUtil only checking of a string prefix of "http://", but fails to detect other protocols such as https. I've attached a new implementation of both affected STKUtil methods. I couldn't create an actual patch in the given timeframe easily, sorry. The following two methods accept any protocol, but still prepend "http://" in case none is given: public static String getExternalLink(Content content, String linkNodeName){ if(!externalLink.contains("://")) { externalLink = "http://"+externalLink; } return externalLink; public static String getExternalLinkTitle(Content content, String linkNodeName, String linkTitleNodeName){ String externalLink = content.getNodeData(linkNodeName).getString(); else { externalLink = ""; } } |
| Comments |
| Comment by Magnolia International [ 26/Oct/10 ] |
|
Here's a patch to fix this; please review and apply. |
| Comment by Philipp Bärfuss [ 26/Oct/10 ] |
|
Seams as if this slipped through. Just added it the maintenance mindmap. |
| Comment by Jan Haderka [ 27/Oct/10 ] |
|
Patch should be improved. getExternalLinkTitle() can just delegate to the getExternalLink() in case title is empty instead of executing exactly same C&P code. |