Browse Source

Implement encodePath

tags/v6.0.0alpha2
Victor Dubiniuk 11 years ago
parent
commit
5a3fce12a4
2 changed files with 30 additions and 1 deletions
  1. 14
    0
      lib/public/util.php
  2. 16
    1
      lib/util.php

+ 14
- 0
lib/public/util.php View File

@@ -355,6 +355,20 @@ class Util {
public static function sanitizeHTML( $value ) {
return(\OC_Util::sanitizeHTML($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) {
return(\OC_Util::encodePath($component));
}

/**
* @brief Returns an array with all keys from input lowercased or uppercased. Numbered indices are left as is.

+ 16
- 1
lib/util.php View File

@@ -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

Loading…
Cancel
Save