Skip to content

Commit 67e0ef5

Browse files
committed
fix(files): Do not array access null value
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
1 parent 54a1a56 commit 67e0ef5

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

lib/private/Files/Storage/Wrapper/Encoding.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,9 @@ public function moveFromStorage(IStorage $sourceStorage, $sourceInternalPath, $t
510510

511511
public function getMetaData($path) {
512512
$entry = $this->storage->getMetaData($this->findPathToUse($path));
513-
$entry['name'] = trim(Filesystem::normalizePath($entry['name']), '/');
513+
if ($entry !== null) {
514+
$entry['name'] = trim(Filesystem::normalizePath($entry['name']), '/');
515+
}
514516
return $entry;
515517
}
516518

tests/lib/Files/Storage/Wrapper/EncodingTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,4 +240,12 @@ public function testNormalizedGetMetaData() {
240240
$entry = $this->instance->getMetaData('/test/' . self::NFD_NAME);
241241
$this->assertEquals(self::NFC_NAME, $entry['name']);
242242
}
243+
244+
/**
245+
* Regression test of https://github.com/nextcloud/server/issues/50431
246+
*/
247+
public function testNoMetadata() {
248+
$this->assertNull($this->instance->getMetaData('/test/null'));
249+
}
250+
243251
}

0 commit comments

Comments
 (0)