diff --git a/lib/FilesHooks.php b/lib/FilesHooks.php index 68390756e..aa1d6ea4e 100644 --- a/lib/FilesHooks.php +++ b/lib/FilesHooks.php @@ -82,10 +82,10 @@ public function fileCreate($path) { return; } - if ($this->currentUser->getUserIdentifier() !== '' || !$this->currentUser->isPublicShareToken()) { - $this->addNotificationsForFileAction($path, Files::TYPE_SHARE_CREATED, 'created_self', 'created_by'); - } else { + if ($this->currentUser->getUserIdentifier() === '' && $this->currentUser->isPublicShareToken()) { $this->addNotificationsForFileAction($path, Files_Sharing::TYPE_PUBLIC_UPLOAD, '', 'created_public'); + } else { + $this->addNotificationsForFileAction($path, Files::TYPE_SHARE_CREATED, 'created_self', 'created_by'); } } diff --git a/tests/FilesHooksTest.php b/tests/FilesHooksTest.php index d31912eee..8457f9818 100644 --- a/tests/FilesHooksTest.php +++ b/tests/FilesHooksTest.php @@ -171,6 +171,8 @@ public static function dataFileCreate(): array { ['user', false, 'created_self', 'created_by', Files::TYPE_SHARE_CREATED], ['', true, '', 'created_public', Files_Sharing::TYPE_PUBLIC_UPLOAD], ['', false, 'created_self', 'created_by', Files::TYPE_SHARE_CREATED], + // logged-in user uploading to a public share link → treated as regular upload + ['user', true, 'created_self', 'created_by', Files::TYPE_SHARE_CREATED], ]; }