diff options
author | Florin Peter <github@florin-peter.de> | 2013-05-23 20:29:46 +0200 |
---|---|---|
committer | Florin Peter <github@florin-peter.de> | 2013-05-23 20:29:46 +0200 |
commit | d4b700ef4ebfa9aba9bcadda864ed5a2a92174ed (patch) | |
tree | dd5c32ef990fdc38bc9ed3c31ffb1c74e3077507 /lib/files | |
parent | 85e0c78166d45b0ef9d00b1fd2164e4969ee9b83 (diff) | |
download | nextcloud-server-d4b700ef4ebfa9aba9bcadda864ed5a2a92174ed.tar.gz nextcloud-server-d4b700ef4ebfa9aba9bcadda864ed5a2a92174ed.zip |
revert previous fix and added normalizer to cache class
Diffstat (limited to 'lib/files')
-rw-r--r-- | lib/files/cache/cache.php | 24 | ||||
-rw-r--r-- | lib/files/cache/scanner.php | 2 |
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); |