Skip to content

Commit 7312c92

Browse files
authored
Merge pull request #50525 from nextcloud/backport/50437/stable29
[stable29] fix: storage wrapper / files scanner do not array access on null
2 parents 12d2254 + 3f8244a commit 7312c92

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

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

+3-1
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,9 @@ public function moveFromStorage(IStorage $sourceStorage, $sourceInternalPath, $t
531531

532532
public function getMetaData($path) {
533533
$entry = $this->storage->getMetaData($this->findPathToUse($path));
534-
$entry['name'] = trim(Filesystem::normalizePath($entry['name']), '/');
534+
if ($entry !== null) {
535+
$entry['name'] = trim(Filesystem::normalizePath($entry['name']), '/');
536+
}
535537
return $entry;
536538
}
537539

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

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

0 commit comments

Comments
 (0)