[Pkg-owncloud-commits] [owncloud] 07/62: Properly return fileid when scanFile() did not find differences
David Prévot
taffit at moszumanska.debian.org
Tue Jun 23 23:39:32 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to annotated tag v8.0.5beta
in repository owncloud.
commit 1fb44bc7a7a8cde197fa8a4fee7fe2f49e69562e
Author: Vincent Petry <pvince81 at owncloud.com>
Date: Mon Jun 1 16:17:00 2015 +0200
Properly return fileid when scanFile() did not find differences
---
lib/private/files/cache/scanner.php | 2 ++
tests/lib/files/cache/scanner.php | 8 ++++++++
2 files changed, 10 insertions(+)
diff --git a/lib/private/files/cache/scanner.php b/lib/private/files/cache/scanner.php
index 4778a68..166c4e8 100644
--- a/lib/private/files/cache/scanner.php
+++ b/lib/private/files/cache/scanner.php
@@ -155,6 +155,8 @@ class Scanner extends BasicEmitter {
$data['fileid'] = $this->addToCache($file, $newData);
$this->emit('\OC\Files\Cache\Scanner', 'postScanFile', array($file, $this->storageId));
\OC_Hook::emit('\OC\Files\Cache\Scanner', 'post_scan_file', array('path' => $file, 'storage' => $this->storageId));
+ } else if (!empty($cacheData)) {
+ $data['fileid'] = $cacheData['fileid'];
}
} else {
$this->removeFromCache($file);
diff --git a/tests/lib/files/cache/scanner.php b/tests/lib/files/cache/scanner.php
index b44cf0a..c174136 100644
--- a/tests/lib/files/cache/scanner.php
+++ b/tests/lib/files/cache/scanner.php
@@ -181,6 +181,14 @@ class Scanner extends \Test\TestCase {
$this->assertEquals($oldData['size'], $newData['size']);
}
+ public function testReuseIdentical() {
+ $this->storage->file_put_contents('file.txt', 'contents');
+ $data = $this->scanner->scanFile('file.txt', \OC\Files\Cache\Scanner::REUSE_ETAG);
+ $this->assertTrue(isset($data['fileid']));
+ $data = $this->scanner->scanFile('file.txt', \OC\Files\Cache\Scanner::REUSE_ETAG);
+ $this->assertTrue(isset($data['fileid']));
+ }
+
public function testRemovedFile() {
$this->fillTestFolders();
--
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