Fix: Return Basename instead of Filename

This commit is contained in:
philipp lang 2024-06-29 10:34:40 +02:00
parent 71903936a3
commit 63c62dc958
2 changed files with 14 additions and 1 deletions

View File

@ -17,7 +17,7 @@ class ResourceData extends Data
return self::from([
'path' => $dir,
'name' => pathinfo($dir, PATHINFO_FILENAME),
'name' => pathinfo($dir, PATHINFO_BASENAME),
'parent' => pathinfo($dir, PATHINFO_DIRNAME),
]);
}

View File

@ -64,4 +64,17 @@ class FileshareFilesActionTest extends FileshareTestCase
->assertJsonPath('data.0.path', '/lala/dd/ee')
->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');
}
}