diff options
author | Victor Dubiniuk <victor.dubiniuk@gmail.com> | 2013-07-04 19:21:49 +0300 |
---|---|---|
committer | Victor Dubiniuk <victor.dubiniuk@gmail.com> | 2013-07-09 17:46:11 +0300 |
commit | 5a3fce12a4496ec6d2903902e035af017e07f2f8 (patch) | |
tree | e8c57c0ae2e5451e1096425fa9036528c7ee3f62 /lib/util.php | |
parent | cc0965b9bca53d4c6e31aed76c8eedea1d65a5c1 (diff) | |
download | nextcloud-server-5a3fce12a4496ec6d2903902e035af017e07f2f8.tar.gz nextcloud-server-5a3fce12a4496ec6d2903902e035af017e07f2f8.zip |
Implement encodePath
Diffstat (limited to 'lib/util.php')
-rwxr-xr-x | lib/util.php | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/lib/util.php b/lib/util.php index 8f5f79b6b09..981b05b2b46 100755 --- a/lib/util.php +++ b/lib/util.php @@ -539,7 +539,22 @@ class OC_Util { } return $value; } - + + /** + * @brief Public function to encode url parameters + * + * This function is used to encode path to file before output. + * Encoding is done according to RFC 3986 with one exception: + * Character '/' is preserved as is. + * + * @param string $component part of URI to encode + * @return string + */ + public static function encodePath($component) { + $encoded = rawurlencode($component); + $encoded = str_replace('%2F', '/', $encoded); + return $encoded; + } /** * Check if the htaccess file is working by creating a test file in the data directory and trying to access via http |