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 ); }