Skip to content

fix: only write activites for actual public uploads#2431

Open
miaulalala wants to merge 2 commits intomasterfrom
fix/2016/false-public-folder-notification
Open

fix: only write activites for actual public uploads#2431
miaulalala wants to merge 2 commits intomasterfrom
fix/2016/false-public-folder-notification

Conversation

@miaulalala
Copy link
Collaborator

Currently, any file activity without a proper session is interpreted to be a public upload. Now, the share token is compared and the activity is only written when the share token belongs to a public folder

Fixes #2016

@miaulalala miaulalala added this to the Nextcloud 34 milestone Mar 6, 2026
@miaulalala miaulalala self-assigned this Mar 6, 2026
@miaulalala miaulalala changed the title fix: only write activites for actualy public uploads fix: only write activites for actual public uploads Mar 6, 2026
@cypress
Copy link

cypress bot commented Mar 6, 2026

Activity    Run #3420

Run Properties:  status check passed Passed #3420  •  git commit 45efb08e45: fix: only write activites for actual public uploads
Project Activity
Branch Review fix/2016/false-public-folder-notification
Run status status check passed Passed #3420
Run duration 02m 06s
Commit git commit 45efb08e45: fix: only write activites for actual public uploads
Committer Anna
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 1
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 9
View all changes introduced in this branch ↗︎

@miaulalala miaulalala force-pushed the fix/2016/false-public-folder-notification branch from ff667c4 to 130975d Compare March 6, 2026 09:59
Currently, any file activity without a proper session is interpreted to be a public upload.
Now, the share token is compared and the activity is only written when the share token belongs to a public folder

Signed-off-by: Anna Larch <anna@nextcloud.com>
@miaulalala miaulalala force-pushed the fix/2016/false-public-folder-notification branch from 130975d to f297929 Compare March 6, 2026 10:04
Signed-off-by: Anna Larch <anna@nextcloud.com>
Comment on lines +110 to +119
if (!empty($this->request->server['PHP_AUTH_USER'])) {
$token = $this->request->server['PHP_AUTH_USER'];
try {
$share = $this->shareManager->getShareByToken($token);
return $share->getShareType() === IShare::TYPE_LINK
|| $share->getShareType() === IShare::TYPE_EMAIL;
} catch (ShareNotFound $e) {
// No share found for this token
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checking the share based on PHP_AUTH_USER would probably conflict the day a user as the same ID as a share. Share's tokens can be manually set nowadays.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm, since it's for activities only, I think it's still better than what we have currently, which is writing an activity on any file action

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

false notification e-mails "... was created in a public folder"

2 participants