Clean paths so they start with one slash.

This commit is contained in:
bootstraponline
2012-08-25 18:41:13 -06:00
parent 0da664299e
commit 1d5f69704a
@@ -99,13 +99,21 @@ $.save = function( commitMessage ) {
var msg = defaultCommitMessage();
var newLocation = baseUrl;
function clean( str ) {
return str.replace(/^\/+/g, '/');
}
// 'a%2Fb' => a/b
if (pathName) {
newLocation += '/' + unescape(pathName);
if ( pathName ) {
pathName = unescape( pathName );
newLocation += '/' + pathName;
pathName = pathName + '/'; // pathName must end with /
pathName = clean( pathName );
}
newLocation += '/' + pageName;
newLocation = clean( newLocation );
// if &create=true then handle create instead of edit.
if ( create ) {