mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-29 03:13:40 +01:00
egw.(de|en)codePath to correctly encode % and #
This commit is contained in:
parent
948e22f5e5
commit
932979e553
@ -7,7 +7,6 @@
|
||||
* @link http://www.egroupware.org
|
||||
* @author Andreas Stöckel (as AT stylite.de)
|
||||
* @author Ralf Becker <RalfBecker@outdoor-training.de>
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/*egw:uses
|
||||
@ -171,7 +170,14 @@ egw.extend('utils', egw.MODULE_GLOBAL, function()
|
||||
* @return {string}
|
||||
*/
|
||||
decodePath: function(_path) {
|
||||
return decodeURIComponent(_path);
|
||||
try {
|
||||
return decodeURIComponent(_path);
|
||||
}
|
||||
catch(e) {
|
||||
// ignore decoding errors, as they usually only mean _path is not encoded
|
||||
egw.debug("error", "decodePath('"+_path+"'): "+e.stack);
|
||||
}
|
||||
return _path;
|
||||
},
|
||||
|
||||
/**
|
||||
@ -192,7 +198,7 @@ egw.extend('utils', egw.MODULE_GLOBAL, function()
|
||||
/**
|
||||
* Encode vfs special chars removing /
|
||||
*
|
||||
* //'%' => '%25', // % should be encoded, but easily leads to double encoding, therefore better NOT encodig it
|
||||
* '%' => '%25',
|
||||
* '#' => '%23',
|
||||
* '?' => '%3F',
|
||||
* '/' => '', // better remove it completly
|
||||
@ -201,7 +207,7 @@ egw.extend('utils', egw.MODULE_GLOBAL, function()
|
||||
* @return {string}
|
||||
*/
|
||||
encodePathComponent: function(_comp) {
|
||||
return _comp.replace(/#/g,'%23').replace(/\?/g,'%3F').replace(/\//g,'');
|
||||
return _comp.replace(/%/g,'%25').replace(/#/g,'%23').replace(/\?/g,'%3F').replace(/\//g,'');
|
||||
},
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user