Fix getDirectoryContent implementation for Jail wrapper
Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
parent
8d5404b750
commit
4e6d3d1880
|
@ -78,12 +78,12 @@ class SwiftFactory {
|
||||||
* @throws StorageAuthException
|
* @throws StorageAuthException
|
||||||
*/
|
*/
|
||||||
public function getCachedTokenId() {
|
public function getCachedTokenId() {
|
||||||
if ( !isset($this->params['cachedToken']) ) {
|
if (!isset($this->params['cachedToken'])) {
|
||||||
throw new StorageAuthException('Unauthenticated ObjectStore connection');
|
throw new StorageAuthException('Unauthenticated ObjectStore connection');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Is it V2 token?
|
// Is it V2 token?
|
||||||
if ( isset($this->params['cachedToken']['token']) ) {
|
if (isset($this->params['cachedToken']['token'])) {
|
||||||
return $this->params['cachedToken']['token']['id'];
|
return $this->params['cachedToken']['token']['id'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -541,6 +541,6 @@ class Jail extends Wrapper {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDirectoryContent($directory): \Traversable {
|
public function getDirectoryContent($directory): \Traversable {
|
||||||
return $this->getWrapperStorage()->getDirectoryContent($this->getJailedPath($directory));
|
return $this->getWrapperStorage()->getDirectoryContent($this->getUnjailedPath($directory));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,6 +88,21 @@ abstract class Storage extends \Test\TestCase {
|
||||||
}
|
}
|
||||||
$this->assertEquals([$directory], $content);
|
$this->assertEquals([$directory], $content);
|
||||||
|
|
||||||
|
$content = iterator_to_array($this->instance->getDirectoryContent('/'));
|
||||||
|
|
||||||
|
$this->assertCount(1, $content);
|
||||||
|
$dirEntry = $content[0];
|
||||||
|
unset($dirEntry['scan_permissions']);
|
||||||
|
unset($dirEntry['etag']);
|
||||||
|
$this->assertEquals([
|
||||||
|
'name' => $directory,
|
||||||
|
'mimetype' => $this->instance->getMimeType($directory),
|
||||||
|
'mtime' => $this->instance->filemtime($directory),
|
||||||
|
'size' => -1,
|
||||||
|
'storage_mtime' => $this->instance->filemtime($directory),
|
||||||
|
'permissions' => $this->instance->getPermissions($directory),
|
||||||
|
], $dirEntry);
|
||||||
|
|
||||||
$this->assertFalse($this->instance->mkdir('/' . $directory)); //can't create existing folders
|
$this->assertFalse($this->instance->mkdir('/' . $directory)); //can't create existing folders
|
||||||
$this->assertTrue($this->instance->rmdir('/' . $directory));
|
$this->assertTrue($this->instance->rmdir('/' . $directory));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue