summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJörn Friedrich Dreyer <jfd@butonic.de>2014-06-26 14:23:56 +0200
committerJörn Friedrich Dreyer <jfd@butonic.de>2014-06-26 17:57:35 +0200
commit94e9efeee78101f62eccc00a8bbe63ed2da92131 (patch)
treeccb2047a645b58a6d4a30e5a4065b62d3e75013e
parent9758c104b781f2dc2ac0bac1265303ac9f3bedef (diff)
downloadnextcloud-server-94e9efeee78101f62eccc00a8bbe63ed2da92131.tar.gz
nextcloud-server-94e9efeee78101f62eccc00a8bbe63ed2da92131.zip
replace % in pattern with .* and surround with ^$ to get a real regex pattern
-rw-r--r--lib/files/cache/cache.php3
1 files changed, 2 insertions, 1 deletions
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 ?';