Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
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
24 changes: 10 additions & 14 deletions lib/Share/Listener.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,20 +60,16 @@ protected function overwriteMountPoint(VerifyMountPointEvent $event): void {
}

if ($event->getParent() === RoomShareProvider::TALK_FOLDER_PLACEHOLDER) {
try {
$userId = $view->getOwner('/');
} catch (\Exception $e) {
// If we fail to get the owner of the view from the cache,
// e.g. because the user never logged in but a cron job runs
// We fall back to calculating the owner from the root of the view:
if (substr_count($view->getRoot(), '/') >= 2) {
// /37c09aa0-1b92-4cf6-8c66-86d8cac8c1d0/files
[, $userId, ] = explode('/', $view->getRoot(), 3);
} else {
// Something weird is going on, we can't fall back more
// so for now we don't overwrite the share path ¯\_(ツ)_/¯
return;
}
// If we fail to get the owner of the view from the cache,
// e.g. because the user never logged in but a cron job runs
// We fall back to calculating the owner from the root of the view:
if (substr_count($view->getRoot(), '/') >= 2) {
// /37c09aa0-1b92-4cf6-8c66-86d8cac8c1d0/files
[, $userId, ] = explode('/', $view->getRoot(), 3);
} else {
// Something weird is going on, we can't fall back more
// so for now we don't overwrite the share path ¯\_(ツ)_/¯
return;
}

$parent = $this->config->getAttachmentFolder($userId);
Expand Down
3 changes: 1 addition & 2 deletions tests/psalm-baseline.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="6.13.1@1e3b7f0a8ab32b23197b91107adc0a7ed8a05b51">
<files psalm-version="6.14.3@d0b040a91f280f071c1abcb1b77ce3822058725a">
<file src="lib/AppInfo/Application.php">
<UndefinedClass>
<code><![CDATA[BeforeTemplateRenderedEvent]]></code>
Expand Down Expand Up @@ -159,7 +159,6 @@
<code><![CDATA[$event->getView()]]></code>
<code><![CDATA[$view]]></code>
<code><![CDATA[$view]]></code>
<code><![CDATA[$view]]></code>
<code><![CDATA[Filesystem]]></code>
</UndefinedClass>
</file>
Expand Down
Loading