summaryrefslogtreecommitdiffstats
path: root/apps/files_trashbin
diff options
context:
space:
mode:
authorBjörn Schießle <schiessle@owncloud.com>2013-06-14 15:07:06 +0200
committerBjörn Schießle <schiessle@owncloud.com>2013-06-14 15:07:06 +0200
commitf91b02e9b68e5478e93ec059a5439b493d1a1d39 (patch)
tree92d98737cd54364f31d080043d06f68da45f2f74 /apps/files_trashbin
parent08f81f3f92c4283b33605490778d375c0f1d2b5a (diff)
downloadnextcloud-server-f91b02e9b68e5478e93ec059a5439b493d1a1d39.tar.gz
nextcloud-server-f91b02e9b68e5478e93ec059a5439b493d1a1d39.zip
only escape glob pattern
Diffstat (limited to 'apps/files_trashbin')
-rw-r--r--apps/files_trashbin/lib/trash.php12
1 files changed, 7 insertions, 5 deletions
diff --git a/apps/files_trashbin/lib/trash.php b/apps/files_trashbin/lib/trash.php
index 2d1830a38f1..e06e959f8eb 100644
--- a/apps/files_trashbin/lib/trash.php
+++ b/apps/files_trashbin/lib/trash.php
@@ -193,10 +193,11 @@ class Trashbin {
$rootView->rename($sharekeys, $user.'/files_trashbin/share-keys/' . $filename . '.d' . $timestamp);
} else {
// get local path to share-keys
- $localShareKeysPath = $rootView->getLocalFile($sharekeys);
+ $localShareKeysPath = $rootView->getLocalFile($sharekeys);
+ $escapedLocalShareKeysPath = preg_replace('/(\*|\?|\[)/', '[$1]', $localShareKeysPath);
// handle share-keys
- $matches = glob(preg_quote($localShareKeysPath).'*.shareKey');
+ $matches = glob($escapedLocalShareKeysPath.'*.shareKey');
foreach ($matches as $src) {
// get source file parts
$pathinfo = pathinfo($src);
@@ -737,14 +738,15 @@ class Trashbin {
*/
private static function getVersionsFromTrash($filename, $timestamp) {
$view = new \OC\Files\View('/'.\OCP\User::getUser().'/files_trashbin/versions');
- $versionsName = $view->getLocalFile($filename);
+ $versionsName = $view->getLocalFile($filename).'.v';
+ $escapedVersionsName = preg_replace('/(\*|\?|\[)/', '[$1]', $versionsName);
$versions = array();
if ($timestamp ) {
// fetch for old versions
- $matches = glob( $versionsName.'.v*.d'.$timestamp );
+ $matches = glob( $escapedVersionsName.'*.d'.$timestamp );
$offset = -strlen($timestamp)-2;
} else {
- $matches = glob( $versionsName.'.v*' );
+ $matches = glob( $escapedVersionsName.'*' );
}
foreach( $matches as $ma ) {