Skip to content
Open
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
2 changes: 1 addition & 1 deletion .github/workflows/integration-pgsql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
- 'sharing-3'
- 'sharing-4'
php-versions: ['8.4']
server-versions: ['stable33']
server-versions: ['revert-59172-revert-58894-stable33-authoritative-share']
guests-versions: ['main']
circles-versions: ['stable33']
notifications-versions: ['stable33']
Expand Down
32 changes: 20 additions & 12 deletions lib/Share/Listener.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,30 +52,38 @@ protected function overwriteShareTarget(BeforeShareCreatedEvent $event): void {

protected function overwriteMountPoint(VerifyMountPointEvent $event): void {
$share = $event->getShare();
$view = $event->getView();

if ($share->getShareType() !== IShare::TYPE_ROOM
&& $share->getShareType() !== RoomShareProvider::SHARE_TYPE_USERROOM) {
return;
}

if ($event->getParent() === RoomShareProvider::TALK_FOLDER_PLACEHOLDER) {
// 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);
if (method_exists($event, 'getUser')) {
$userId = $event->getUser()->getUID();
} else {
// Something weird is going on, we can't fall back more
// so for now we don't overwrite the share path ¯\_(ツ)_/¯
return;
$view = $event->getView();
// 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);
$event->setParent($parent);
if (!$event->getView()->is_dir($parent)) {
$event->getView()->mkdir($parent);
if (method_exists($event, 'setCreateParent')) {
$event->setCreateParent(true);
} else {
if (!$event->getView()->is_dir($parent)) {
$event->getView()->mkdir($parent);
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/features/sharing-1/create.feature
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ Feature: create
| item_type | file |
| mimetype | text/plain |
| storage_id | home::participant2 |
| file_target | /{TALK_PLACEHOLDER}/welcome (2).txt |
| file_target | /Talk/welcome (2).txt |
| share_with | group room |
| share_with_displayname | Group room |
And user "participant3" gets last share
Expand Down
2 changes: 2 additions & 0 deletions tests/integration/features/sharing-2/get.feature
Original file line number Diff line number Diff line change
Expand Up @@ -1315,6 +1315,7 @@ Feature: get
And user "participant2" gets the DAV properties for "/"
And the list of returned files for "participant2" is
| / |
| /Talk/ |
| /welcome.txt |

Scenario: get files after deleting a received share
Expand Down Expand Up @@ -1347,6 +1348,7 @@ Feature: get
And user "participant2" gets the DAV properties for "/"
And the list of returned files for "participant2" is
| / |
| /Talk/ |
| /welcome.txt |


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ Feature: transfer-ownership
| item_type | file |
| mimetype | text/plain |
| storage_id | home::participant3 |
| file_target | /{TALK_PLACEHOLDER}/welcome (2).txt |
| file_target | /Talk/welcome (2).txt |
| share_with | group room |
| share_with_displayname | Group room |

Expand Down
Loading