summaryrefslogtreecommitdiffstats
path: root/lib/files/cache/cache.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/files/cache/cache.php')
-rw-r--r--lib/files/cache/cache.php19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/files/cache/cache.php b/lib/files/cache/cache.php
index b912b4423e7..2c34fb77925 100644
--- a/lib/files/cache/cache.php
+++ b/lib/files/cache/cache.php
@@ -100,6 +100,9 @@ class Cache {
*/
public function get($file) {
if (is_string($file) or $file == '') {
+ // normalize file
+ $file = $this->normalize($file);
+
$where = 'WHERE `storage` = ? AND `path_hash` = ?';
$params = array($this->getNumericStorageId(), md5($file));
} else { //file id
@@ -179,6 +182,9 @@ class Cache {
$this->update($id, $data);
return $id;
} else {
+ // normalize file
+ $file = $this->normalize($file);
+
if (isset($this->partial[$file])) { //add any saved partial data
$data = array_merge($this->partial[$file], $data);
unset($this->partial[$file]);
@@ -267,6 +273,9 @@ class Cache {
* @return int
*/
public function getId($file) {
+ // normalize file
+ $file = $this->normalize($file);
+
$pathHash = md5($file);
$query = \OC_DB::prepare('SELECT `fileid` FROM `*PREFIX*filecache` WHERE `storage` = ? AND `path_hash` = ?');
@@ -551,4 +560,14 @@ class Cache {
return null;
}
}
+
+ /**
+ * normalize the given path
+ * @param $path
+ * @return string
+ */
+ public function normalize($path) {
+
+ return \OC_Util::normalizeUnicode($path);
+ }
}