only escape glob pattern
This commit is contained in:
parent
08f81f3f92
commit
f91b02e9b6
|
@ -194,9 +194,10 @@ class Trashbin {
|
||||||
} else {
|
} else {
|
||||||
// get local path to share-keys
|
// get local path to share-keys
|
||||||
$localShareKeysPath = $rootView->getLocalFile($sharekeys);
|
$localShareKeysPath = $rootView->getLocalFile($sharekeys);
|
||||||
|
$escapedLocalShareKeysPath = preg_replace('/(\*|\?|\[)/', '[$1]', $localShareKeysPath);
|
||||||
|
|
||||||
// handle share-keys
|
// handle share-keys
|
||||||
$matches = glob(preg_quote($localShareKeysPath).'*.shareKey');
|
$matches = glob($escapedLocalShareKeysPath.'*.shareKey');
|
||||||
foreach ($matches as $src) {
|
foreach ($matches as $src) {
|
||||||
// get source file parts
|
// get source file parts
|
||||||
$pathinfo = pathinfo($src);
|
$pathinfo = pathinfo($src);
|
||||||
|
@ -737,14 +738,15 @@ class Trashbin {
|
||||||
*/
|
*/
|
||||||
private static function getVersionsFromTrash($filename, $timestamp) {
|
private static function getVersionsFromTrash($filename, $timestamp) {
|
||||||
$view = new \OC\Files\View('/'.\OCP\User::getUser().'/files_trashbin/versions');
|
$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();
|
$versions = array();
|
||||||
if ($timestamp ) {
|
if ($timestamp ) {
|
||||||
// fetch for old versions
|
// fetch for old versions
|
||||||
$matches = glob( $versionsName.'.v*.d'.$timestamp );
|
$matches = glob( $escapedVersionsName.'*.d'.$timestamp );
|
||||||
$offset = -strlen($timestamp)-2;
|
$offset = -strlen($timestamp)-2;
|
||||||
} else {
|
} else {
|
||||||
$matches = glob( $versionsName.'.v*' );
|
$matches = glob( $escapedVersionsName.'*' );
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach( $matches as $ma ) {
|
foreach( $matches as $ma ) {
|
||||||
|
|
|
@ -241,11 +241,12 @@ class Storage {
|
||||||
public static function getVersions($uid, $filename, $count = 0 ) {
|
public static function getVersions($uid, $filename, $count = 0 ) {
|
||||||
if( \OCP\Config::getSystemValue('files_versions', Storage::DEFAULTENABLED)=='true' ) {
|
if( \OCP\Config::getSystemValue('files_versions', Storage::DEFAULTENABLED)=='true' ) {
|
||||||
$versions_fileview = new \OC\Files\View('/' . $uid . '/files_versions');
|
$versions_fileview = new \OC\Files\View('/' . $uid . '/files_versions');
|
||||||
$versionsName = $versions_fileview->getLocalFile($filename);
|
$versionsName = \OC_Filesystem::normalizePath($versions_fileview->getLocalFile($filename).'.v');
|
||||||
|
$escapedVersionName = preg_replace('/(\*|\?|\[)/', '[$1]', $versionsName);
|
||||||
|
|
||||||
$versions = array();
|
$versions = array();
|
||||||
// fetch for old versions
|
// fetch for old versions
|
||||||
$matches = glob(preg_quote($versionsName).'.v*' );
|
$matches = glob($escapedVersionName.'*');
|
||||||
|
|
||||||
if ( !$matches ) {
|
if ( !$matches ) {
|
||||||
return $versions;
|
return $versions;
|
||||||
|
|
Loading…
Reference in New Issue