[
http://jira.magnolia-cms.com/browse/MGNLSTK-551?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Ondřej Chytil reassigned MGNLSTK-551:
-------------------------------------
Assignee: Ondřej Chytil (was: Philipp Bärfuss)
> External links do not allow any other protocol than http
> --------------------------------------------------------
>
> Key: MGNLSTK-551
> URL: http://jira.magnolia-cms.com/browse/MGNLSTK-551
> Project: Magnolia Standard Templating Kit
> Issue Type: Bug
> Affects Versions: 1.1.2
> Environment: any
> Reporter: Andreas Weder
> Assignee: Ondřej Chytil
> Fix For: 1.3.x
>
> Attachments: MGNLSTK-551.patch
>
>
> 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){
> String externalLink = content.getNodeData(linkNodeName).getString();
> if(!externalLink.contains("://")){
> externalLink = "http://"+externalLink;
> }
> return externalLink;
> }
> public static String getExternalLinkTitle(Content content, String
> linkNodeName, String linkTitleNodeName){
> String linkTitle = content.getNodeData(linkTitleNodeName).getString();
> if(StringUtils.isNotEmpty(linkTitle)){
> return linkTitle;
> }
> String externalLink = content.getNodeData(linkNodeName).getString();
> int idx = externalLink.indexOf("://");
> if(idx != -1){
> if (externalLink.length() > idx+3) {
> externalLink = externalLink.substring(idx+3);
> } else {
> externalLink = "";
> }
> }
> return externalLink;
> }
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.magnolia-cms.com/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------