[Pkg-owncloud-commits] [owncloud] 01/16: replace % in pattern with .* and surround with ^$ to get a real regex pattern

David Prévot taffit at moszumanska.debian.org
Wed Mar 11 15:49:29 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to annotated tag v5.0.19
in repository owncloud.

commit 94e9efeee78101f62eccc00a8bbe63ed2da92131
Author: Jörn Friedrich Dreyer <jfd at butonic.de>
Date:   Thu Jun 26 14:23:56 2014 +0200

    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 3bf0724..a283229 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 ?';

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list