Ver código fonte

Merge pull request #16622 from owncloud/versions-cancelexpireforunexistingfiles

Abort expiration when file is gone
tags/v8.1RC2
Björn Schießle 9 anos atrás
pai
commit
01a241f711

+ 5
- 1
apps/files_versions/lib/storage.php Ver arquivo

@@ -346,7 +346,7 @@ class Storage {
*/
public static function getVersions($uid, $filename, $userFullPath = '') {
$versions = array();
if ($filename === '') {
if (empty($filename)) {
return $versions;
}
// fetch for old versions
@@ -556,6 +556,10 @@ class Storage {
$config = \OC::$server->getConfig();
if($config->getSystemValue('files_versions', Storage::DEFAULTENABLED)=='true') {
list($uid, $filename) = self::getUidAndFilename($filename);
if (empty($filename)) {
// file maybe renamed or deleted
return false;
}
$versionsFileview = new \OC\Files\View('/'.$uid.'/files_versions');

// get available disk space for user

+ 10
- 0
apps/files_versions/tests/versions.php Ver arquivo

@@ -552,10 +552,20 @@ class Test_Files_Versioning extends \Test\TestCase {
public function testGetVersionsEmptyFile() {
// execute copy hook of versions app
$versions = \OCA\Files_Versions\Storage::getVersions(self::TEST_VERSIONS_USER, '');
$this->assertCount(0, $versions);

$versions = \OCA\Files_Versions\Storage::getVersions(self::TEST_VERSIONS_USER, null);
$this->assertCount(0, $versions);
}

public function testExpireNonexistingFile() {
$this->logout();
// needed to have a FS setup (the background job does this)
\OC_Util::setupFS(self::TEST_VERSIONS_USER);

$this->assertFalse(\OCA\Files_Versions\Storage::expire('/void/unexist.txt'));
}

public function testRestoreSameStorage() {
\OC\Files\Filesystem::mkdir('sub');
$this->doTestRestore();

Carregando…
Cancelar
Salvar