summaryrefslogtreecommitdiffstats
path: root/lib/files
diff options
context:
space:
mode:
Diffstat (limited to 'lib/files')
-rw-r--r--lib/files/cache/cache.php24
-rw-r--r--lib/files/cache/scanner.php2
2 files changed, 25 insertions, 1 deletions
diff --git a/lib/files/cache/cache.php b/lib/files/cache/cache.php
index 3341fe50525..a7e634c8e41 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
@@ -177,6 +180,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]);
@@ -265,6 +271,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` = ?');
@@ -549,4 +558,19 @@ class Cache {
return null;
}
}
+
+ /**
+ * normalize the given path
+ * @param $path
+ * @return string
+ */
+ public function normalize($path) {
+
+ //normalize unicode if possible
+ if (class_exists('Normalizer')) {
+ $path = \Normalizer::normalize($path);
+ }
+
+ return $path;
+ }
}
diff --git a/lib/files/cache/scanner.php b/lib/files/cache/scanner.php
index b73e2e83fcc..a98953b42aa 100644
--- a/lib/files/cache/scanner.php
+++ b/lib/files/cache/scanner.php
@@ -114,7 +114,7 @@ class Scanner {
$size = 0;
if ($this->storage->is_dir($path) && ($dh = $this->storage->opendir($path))) {
\OC_DB::beginTransaction();
- while ($file = utf8_encode(readdir($dh))) {
+ while ($file = readdir($dh)) {
$child = ($path) ? $path . '/' . $file : $file;
if (!$this->isIgnoredDir($file)) {
$data = $this->scanFile($child, $recursive === self::SCAN_SHALLOW);