From 94e9efeee78101f62eccc00a8bbe63ed2da92131 Mon Sep 17 00:00:00 2001 From: Jörn Friedrich Dreyer Date: Thu, 26 Jun 2014 14:23:56 +0200 Subject: replace % in pattern with .* and surround with ^$ to get a real regex pattern --- lib/files/cache/cache.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/files/cache/cache.php b/lib/files/cache/cache.php index 3bf0724143d..a2832296436 100644 --- a/lib/files/cache/cache.php +++ b/lib/files/cache/cache.php @@ -521,7 +521,8 @@ class Cache { WHERE `storage` = ? AND '; if(\OC_Config::getValue( 'dbtype', 'sqlite' ) === 'oci') { //remove starting and ending % from the pattern - $pattern = trim($pattern, '%'); + $pattern = preg_quote($pattern); + $pattern = '^'.str_replace('%', '.*', $pattern).'$'; $sql .= 'REGEXP_LIKE(`name`, ?, \'i\')'; } else { $sql .= '`name` LIKE ?'; -- cgit v1.2.3