From d0dd23fc112153b0e06dc22f5b2b1777ed9a4159 Mon Sep 17 00:00:00 2001 From: bootstraponline Date: Thu, 30 Aug 2012 11:09:44 -0300 Subject: [PATCH] Fix path --- .../frontend/public/gollum/livepreview/js/livepreview.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/gollum/frontend/public/gollum/livepreview/js/livepreview.js b/lib/gollum/frontend/public/gollum/livepreview/js/livepreview.js index 4fe66266..058a7be0 100644 --- a/lib/gollum/frontend/public/gollum/livepreview/js/livepreview.js +++ b/lib/gollum/frontend/public/gollum/livepreview/js/livepreview.js @@ -342,10 +342,15 @@ var applyTimeout = function () { ~-1 == false; !~-1 == true; */ if ( !~location.host.indexOf('github.com') ) { + // ensure leading / is removed from path and that it ends with / + var path = unescape($.key( 'path' )).replace(/^\/+/, ''); + if ( path.charAt( path.length - 1 ) !== '/' ) { + path += '/'; + } + jQuery.ajax( { type: 'GET', - // ensure leading / is removed from path - url: baseUrl + '/data/' + $.key( 'path' ).replace(/^\/+/, '') + $.key( 'page' ), + url: baseUrl + '/data/' + path + $.key( 'page' ), success: function( data ) { editorSession.setValue( data ); }