You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Filippo Del Trappeto (JIRA)" <ji...@apache.org> on 2013/03/21 13:41:15 UTC

[jira] [Created] (SLING-2794) Sling._replaceExtension() Javascript function tries to replace the path extension twice

Filippo Del Trappeto created SLING-2794:
-------------------------------------------

             Summary: Sling._replaceExtension() Javascript function tries to replace the path extension twice
                 Key: SLING-2794
                 URL: https://issues.apache.org/jira/browse/SLING-2794
             Project: Sling
          Issue Type: Bug
          Components: General
            Reporter: Filippo Del Trappeto
            Priority: Minor


The Sling._replaceExtension() Javascript function, in /system/sling.js , tries to replace the path extension twice, so the URL "http://192.168.1.2/content/blog/mypost.html" becomes something like "http://192.168.1.json", causing problems in the "46 lines blog example".

Firebug shows me:

{code}
 /** Replace extension in a path */
Sling._replaceExtension = function(path,newExtension) {
var i = path.lastIndexOf(".");
if(i >= 0) path = path.substring(0,i);
i = path.lastIndexOf(".");
if(i >= 0) path = path.substring(0,i);
return path + newExtension;
} 
{code}


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira