diff --git a/build/libifm.php b/build/libifm.php index 615ea7e..81f0faa 100644 --- a/build/libifm.php +++ b/build/libifm.php @@ -966,7 +966,7 @@ function IFM( params ) { self.currentDir = data.realpath; self.refreshFileTable(); $( "#currentDir" ).val( self.currentDir ); - if( config.pushState ) history.pushState( { dir: self.currentDir }, self.currentDir, "#"+self.currentDir ); + if( config.pushState ) history.pushState( { dir: self.currentDir }, self.currentDir, "#"+encodeURIComponent( self.currentDir ) ); }, error: function() { self.showMessage( "General error occured: No or broken response", "e" ); } }); @@ -1772,7 +1772,8 @@ function IFM( params ) { */ this.historyPopstateHandler = function(event) { var dir = ""; - if( event.state && event.state.dir ) dir = event.state.dir; + if( event.state && event.state.dir ) + dir = event.state.dir; self.changeDirectory( dir, { pushState: false, absolute: true } ); }; @@ -2048,7 +2049,7 @@ function IFM( params ) { window.onpopstate = self.historyPopstateHandler; // load initial file table if( window.location.hash ) { - self.changeDirectory( window.location.hash.substring( 1 ) ); + self.changeDirectory( decodeURIComponent( window.location.hash.substring( 1 ) ) ); } else { this.refreshFileTable(); } diff --git a/ifm.php b/ifm.php index bc58f15..c53339a 100644 --- a/ifm.php +++ b/ifm.php @@ -966,7 +966,7 @@ function IFM( params ) { self.currentDir = data.realpath; self.refreshFileTable(); $( "#currentDir" ).val( self.currentDir ); - if( config.pushState ) history.pushState( { dir: self.currentDir }, self.currentDir, "#"+self.currentDir ); + if( config.pushState ) history.pushState( { dir: self.currentDir }, self.currentDir, "#"+encodeURIComponent( self.currentDir ) ); }, error: function() { self.showMessage( "General error occured: No or broken response", "e" ); } }); @@ -1772,7 +1772,8 @@ function IFM( params ) { */ this.historyPopstateHandler = function(event) { var dir = ""; - if( event.state && event.state.dir ) dir = event.state.dir; + if( event.state && event.state.dir ) + dir = event.state.dir; self.changeDirectory( dir, { pushState: false, absolute: true } ); }; @@ -2048,7 +2049,7 @@ function IFM( params ) { window.onpopstate = self.historyPopstateHandler; // load initial file table if( window.location.hash ) { - self.changeDirectory( window.location.hash.substring( 1 ) ); + self.changeDirectory( decodeURIComponent( window.location.hash.substring( 1 ) ) ); } else { this.refreshFileTable(); } diff --git a/src/ifm.js b/src/ifm.js index 44b4147..9e8592b 100644 --- a/src/ifm.js +++ b/src/ifm.js @@ -228,7 +228,7 @@ function IFM( params ) { self.currentDir = data.realpath; self.refreshFileTable(); $( "#currentDir" ).val( self.currentDir ); - if( config.pushState ) history.pushState( { dir: self.currentDir }, self.currentDir, "#"+self.currentDir ); + if( config.pushState ) history.pushState( { dir: self.currentDir }, self.currentDir, "#"+encodeURIComponent( self.currentDir ) ); }, error: function() { self.showMessage( "General error occured: No or broken response", "e" ); } }); @@ -1034,7 +1034,8 @@ function IFM( params ) { */ this.historyPopstateHandler = function(event) { var dir = ""; - if( event.state && event.state.dir ) dir = event.state.dir; + if( event.state && event.state.dir ) + dir = event.state.dir; self.changeDirectory( dir, { pushState: false, absolute: true } ); }; @@ -1310,7 +1311,7 @@ function IFM( params ) { window.onpopstate = self.historyPopstateHandler; // load initial file table if( window.location.hash ) { - self.changeDirectory( window.location.hash.substring( 1 ) ); + self.changeDirectory( decodeURIComponent( window.location.hash.substring( 1 ) ) ); } else { this.refreshFileTable(); }