Skip to content

Commit

Permalink
fix(files): Do not array access null value
Browse files Browse the repository at this point in the history
Signed-off-by: Ferdinand Thiessen <[email protected]>
  • Loading branch information
susnux committed Jan 28, 2025
1 parent 54a1a56 commit 67e0ef5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/private/Files/Storage/Wrapper/Encoding.php
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,9 @@ public function moveFromStorage(IStorage $sourceStorage, $sourceInternalPath, $t

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;
}

Expand Down
8 changes: 8 additions & 0 deletions tests/lib/Files/Storage/Wrapper/EncodingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -240,4 +240,12 @@ public function testNormalizedGetMetaData() {
$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'));
}

}

0 comments on commit 67e0ef5

Please sign in to comment.