Commit 892f3cf9 authored by Antoine Cellerier's avatar Antoine Cellerier

Fix windows browser bug: first directory or filename character was removed.

parent 44e5326d
...@@ -235,7 +235,7 @@ function check_and_replace_int( id, val ) ...@@ -235,7 +235,7 @@ function check_and_replace_int( id, val )
} }
function addslashes( str ){ return str.replace(/\'/g, '\\\''); } function addslashes( str ){ return str.replace(/\'/g, '\\\''); }
function escapebackslashes( str ){ return str.replace(/\\[^']/g, '\\\\'); } function escapebackslashes( str ){ return str.replace(/\\/g, '\\\\'); }
function toCamelCase( str ) function toCamelCase( str )
{ {
...@@ -656,11 +656,11 @@ function parse_browse_dir( ) ...@@ -656,11 +656,11 @@ function parse_browse_dir( )
setclass( item, 'browser' ); setclass( item, 'browser' );
if( elt.getAttribute( 'type' ) == 'directory' ) if( elt.getAttribute( 'type' ) == 'directory' )
{ {
item.setAttribute( 'href', 'javascript:browse_dir(\''+escapebackslashes(addslashes(elt.getAttribute( 'path' )))+'\');'); item.setAttribute( 'href', 'javascript:browse_dir(\''+addslashes(escapebackslashes(elt.getAttribute( 'path' )))+'\');');
} }
else else
{ {
item.setAttribute( 'href', 'javascript:browse_path(\''+escapebackslashes(addslashes(elt.getAttribute( 'path' )))+'\');' ); item.setAttribute( 'href', 'javascript:browse_path(\''+addslashes(escapebackslashes(elt.getAttribute( 'path' )))+'\');' );
} }
item.appendChild( document.createTextNode( elt.getAttribute( 'name' ) ) ); item.appendChild( document.createTextNode( elt.getAttribute( 'name' ) ) );
pos.appendChild( item ); pos.appendChild( item );
...@@ -669,7 +669,7 @@ function parse_browse_dir( ) ...@@ -669,7 +669,7 @@ function parse_browse_dir( )
pos.appendChild( document.createTextNode( ' ' ) ); pos.appendChild( document.createTextNode( ' ' ) );
var item = document.createElement( "a" ); var item = document.createElement( "a" );
setclass( item, 'browser' ); setclass( item, 'browser' );
item.setAttribute( 'href', 'javascript:browse_path(\''+escapebackslashes(addslashes(elt.getAttribute( 'path' )))+'\');'); item.setAttribute( 'href', 'javascript:browse_path(\''+addslashes(escapebackslashes(elt.getAttribute( 'path' )))+'\');');
item.appendChild( document.createTextNode( '(select)' ) ); item.appendChild( document.createTextNode( '(select)' ) );
pos.appendChild( item ); pos.appendChild( item );
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment