From 191faa46787c728ee1d950fc885ac9d0a62e86f7 Mon Sep 17 00:00:00 2001 From: Marco Dickert Date: Mon, 24 Jul 2017 15:01:11 +0200 Subject: [PATCH] fix correct encoding/decoding of folder urls in the browser history --- build/libifm.php | 4 ++-- ifm.php | 4 ++-- src/ifm.js | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/build/libifm.php b/build/libifm.php index 615ea7e..abdafd8 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,7 @@ 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 = decodeURIComponent( event.state.dir ); self.changeDirectory( dir, { pushState: false, absolute: true } ); }; diff --git a/ifm.php b/ifm.php index bc58f15..a1ec207 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,7 @@ 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 = decodeURIComponent( event.state.dir ); self.changeDirectory( dir, { pushState: false, absolute: true } ); }; diff --git a/src/ifm.js b/src/ifm.js index 44b4147..9a2e2e1 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,7 @@ 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 = decodeURIComponent( event.state.dir ); self.changeDirectory( dir, { pushState: false, absolute: true } ); };