Fix: Return Basename instead of Filename
This commit is contained in:
parent
71903936a3
commit
63c62dc958
|
@ -17,7 +17,7 @@ class ResourceData extends Data
|
||||||
|
|
||||||
return self::from([
|
return self::from([
|
||||||
'path' => $dir,
|
'path' => $dir,
|
||||||
'name' => pathinfo($dir, PATHINFO_FILENAME),
|
'name' => pathinfo($dir, PATHINFO_BASENAME),
|
||||||
'parent' => pathinfo($dir, PATHINFO_DIRNAME),
|
'parent' => pathinfo($dir, PATHINFO_DIRNAME),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,4 +64,17 @@ class FileshareFilesActionTest extends FileshareTestCase
|
||||||
->assertJsonPath('data.0.path', '/lala/dd/ee')
|
->assertJsonPath('data.0.path', '/lala/dd/ee')
|
||||||
->assertJsonPath('data.0.parent', '/lala/dd');
|
->assertJsonPath('data.0.parent', '/lala/dd');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testItGetsFilesWithDot(): void
|
||||||
|
{
|
||||||
|
$this->withoutExceptionHandling()->login()->loginNami()->withOwncloudUser('badenpowell', 'secret')
|
||||||
|
->withDirs('badenpowell', ['/1. aa']);
|
||||||
|
|
||||||
|
$connection = Fileshare::factory()
|
||||||
|
->type(OwncloudConnection::from(['user' => 'badenpowell', 'password' => 'secret', 'base_url' => env('TEST_OWNCLOUD_DOMAIN')]))
|
||||||
|
->create();
|
||||||
|
|
||||||
|
$this->postJson(route('api.fileshare.files', ['fileshare' => $connection]), ['parent' => '/'])
|
||||||
|
->assertJsonPath('data.0.name', '1. aa');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue