we should also normalize on update and search because the database layer will not do this for us

This commit is contained in:
Florin Peter 2013-05-25 20:35:12 +02:00
parent c245f5a99f
commit 505a300776
1 changed files with 15 additions and 0 deletions

View File

@ -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` = ?'