also detect files in a .part folder as part file
This commit is contained in:
parent
0036c637fc
commit
8185eaa6dd
|
@ -408,6 +408,10 @@ class Scanner extends BasicEmitter {
|
||||||
if (pathinfo($file, PATHINFO_EXTENSION) === 'part') {
|
if (pathinfo($file, PATHINFO_EXTENSION) === 'part') {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
if (strpos($file, '.part/') !== false) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -284,4 +284,27 @@ class Scanner extends \Test\TestCase {
|
||||||
$cachedData = $this->cache->get('folder/bar.txt');
|
$cachedData = $this->cache->get('folder/bar.txt');
|
||||||
$this->assertEquals($newFolderId, $cachedData['parent']);
|
$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],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue