also detect files in a .part folder as part file

This commit is contained in:
Bjoern Schiessle 2015-10-12 13:59:16 +02:00
parent 0036c637fc
commit 8185eaa6dd
2 changed files with 27 additions and 0 deletions

View File

@ -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;
}

View File

@ -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],
];
}
}