diff --git a/lib/FilesHooks.php b/lib/FilesHooks.php index 33d999127..b39e41aeb 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 33f025750..5a7ec0dbb 100644 --- a/tests/FilesHooksTest.php +++ b/tests/FilesHooksTest.php @@ -179,6 +179,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], ]; }