fix(files): Do not array access null value

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
pull/50437/head
Ferdinand Thiessen 2025-01-28 20:51:42 +07:00
parent 54a1a560bd
commit 67e0ef5b72
No known key found for this signature in database
GPG Key ID: 45FAE7268762B400
2 changed files with 11 additions and 1 deletions

@ -510,7 +510,9 @@ class Encoding extends Wrapper {
public function getMetaData($path) {
$entry = $this->storage->getMetaData($this->findPathToUse($path));
$entry['name'] = trim(Filesystem::normalizePath($entry['name']), '/');
if ($entry !== null) {
$entry['name'] = trim(Filesystem::normalizePath($entry['name']), '/');
}
return $entry;
}

@ -240,4 +240,12 @@ class EncodingTest extends \Test\Files\Storage\Storage {
$entry = $this->instance->getMetaData('/test/' . self::NFD_NAME);
$this->assertEquals(self::NFC_NAME, $entry['name']);
}
/**
* Regression test of https://github.com/nextcloud/server/issues/50431
*/
public function testNoMetadata() {
$this->assertNull($this->instance->getMetaData('/test/null'));
}
}