From 505a300776a958f4076f923b0966ab13eee3c4b5 Mon Sep 17 00:00:00 2001 From: Florin Peter <github@florin-peter.de> Date: Sat, 25 May 2013 20:35:12 +0200 Subject: [PATCH] we should also normalize on update and search because the database layer will not do this for us --- lib/files/cache/cache.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/files/cache/cache.php b/lib/files/cache/cache.php index dc5e3e20fc..1e93cc59c6 100644 --- a/lib/files/cache/cache.php +++ b/lib/files/cache/cache.php @@ -226,6 +226,17 @@ class Cache { * @param array $data */ public function update($id, array $data) { + + if(isset($data['path'])) { + // normalize path + $data['path'] = $this->normalize($data['path']); + } + + if(isset($data['name'])) { + // normalize path + $data['name'] = $this->normalize($data['name']); + } + list($queryParts, $params) = $this->buildParts($data); $params[] = $id; @@ -418,6 +429,10 @@ class Cache { * @return array of file data */ public function search($pattern) { + + // normalize pattern + $pattern = $this->normalize($pattern); + $query = \OC_DB::prepare(' SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`, `encrypted`, `unencrypted_size`, `etag` FROM `*PREFIX*filecache` WHERE `name` LIKE ? AND `storage` = ?' -- GitLab