summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/private/files/cache/scanner.php4
-rw-r--r--tests/lib/files/cache/scanner.php23
2 files changed, 27 insertions, 0 deletions
diff --git a/lib/private/files/cache/scanner.php b/lib/private/files/cache/scanner.php
index dbffba1e306..b0890dcdc00 100644
--- a/lib/private/files/cache/scanner.php
+++ b/lib/private/files/cache/scanner.php
@@ -408,6 +408,10 @@ class Scanner extends BasicEmitter {
if (pathinfo($file, PATHINFO_EXTENSION) === 'part') {
return true;
}
+ if (strpos($file, '.part/') !== false) {
+ return true;
+ }
+
return false;
}
diff --git a/tests/lib/files/cache/scanner.php b/tests/lib/files/cache/scanner.php
index b44cf0a49df..871b12bac3a 100644
--- a/tests/lib/files/cache/scanner.php
+++ b/tests/lib/files/cache/scanner.php
@@ -284,4 +284,27 @@ class Scanner extends \Test\TestCase {
$cachedData = $this->cache->get('folder/bar.txt');
$this->assertEquals($newFolderId, $cachedData['parent']);
}
+
+ /**
+ * @dataProvider dataTestIsPartialFile
+ *
+ * @param string $path
+ * @param bool $expected
+ */
+ public function testIsPartialFile($path, $expected) {
+ $this->assertSame($expected,
+ $this->scanner->isPartialFile($path)
+ );
+ }
+
+ public function dataTestIsPartialFile() {
+ return [
+ ['foo.txt.part', true],
+ ['/sub/folder/foo.txt.part', true],
+ ['/sub/folder.part/foo.txt', true],
+ ['foo.txt', false],
+ ['/sub/folder/foo.txt', false],
+ ];
+ }
+
}