Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix tests
Signed-off-by: Robin Appelman <[email protected]>
  • Loading branch information
icewind1991 committed Feb 7, 2023
commit 9f3dbb699a4e1e0fbfc55e1fb9bb070e26816e20
14 changes: 11 additions & 3 deletions lib/private/Files/Mount/MountPoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,11 +196,15 @@ public function getStorage() {
}

/**
* @return string
* @return string|null
*/
public function getStorageId() {
if (!$this->storageId) {
$this->storageId = $this->getStorage()->getId();
$storage = $this->getStorage();
if (is_null($storage)) {
return null;
}
$this->storageId = $storage->getId();
if (strlen($this->storageId) > 64) {
$this->storageId = md5($this->storageId);
}
Expand All @@ -213,7 +217,11 @@ public function getStorageId() {
*/
public function getNumericStorageId() {
if (is_null($this->numericStorageId)) {
$this->numericStorageId = $this->getStorage()->getStorageCache()->getNumericId();
$storage = $this->getStorage();
if (is_null($storage)) {
return -1;
}
$this->numericStorageId = $storage->getStorageCache()->getNumericId();
}
return $this->numericStorageId;
}
Expand Down
4 changes: 2 additions & 2 deletions lib/public/Files/Mount/IMountPoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,15 @@ public function getStorage();
/**
* Get the id of the storages
*
* @return string
* @return string|null
* @since 8.0.0
*/
public function getStorageId();

/**
* Get the id of the storages
*
* @return int
* @return int|null
* @since 9.1.0
*/
public function getNumericStorageId();
Expand Down
3 changes: 3 additions & 0 deletions tests/lib/Files/ViewTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1590,6 +1590,9 @@ private function createTestMovableMountPoints($mountPoints) {
->setConstructorArgs([[]])
->getMock();
$storage->method('getId')->willReturn('non-null-id');
$storage->method('getStorageCache')->willReturnCallback(function () use ($storage) {
return new \OC\Files\Cache\Storage($storage);
});

$mounts[] = $this->getMockBuilder(TestMoveableMountPoint::class)
->setMethods(['moveMount'])
Expand Down