Skip to content

[stable33] fix(files_sharing): validate input in PublicPreviewController#getPreview - #63226

Draft
backportbot[bot] wants to merge 1 commit into
stable33from
backport/61960/stable33
Draft

[stable33] fix(files_sharing): validate input in PublicPreviewController#getPreview#63226
backportbot[bot] wants to merge 1 commit into
stable33from
backport/61960/stable33

Conversation

@backportbot

@backportbot backportbot Bot commented Aug 13, 2026

Copy link
Copy Markdown

Backport of #61960

Warning, This backport's changes differ from the original and might be incomplete ⚠️

Todo

  • Review and resolve any conflicts
  • Review and verify the backported changes
  • Amend HEAD commit to remove the line stating to skip CI

Learn more about backports at https://docs.nextcloud.com/server/stable/go.php?to=developer-backports.

fix(files_sharing): validate input in PublicPreviewController#getPreview

Return 400 Bad Request when the file parameter is empty and the shared

node is a folder, instead of passing the folder itself to getPreview

which triggers an internal server error.

Also rename the local variable to $fileNode to prevent the catch block

from calling getMimeType() on the original string parameter when

get() throws NotFoundException.

Fixes #59229

Assisted-by: ClaudeCode:claude-opus-4-6

Assisted-by: ClaudeCode:claude-opus-5

Signed-off-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>

Signed-off-by: Josh <josh.t.richards@gmail.com>

Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>

# Conflicts:

#	apps/files_sharing/lib/Controller/PublicPreviewController.php

# Conflicts:

#	apps/files_sharing/lib/Controller/PublicPreviewController.php

[skip ci]
@backportbot
backportbot Bot requested review from CarlSchwan, kesselb and susnux August 13, 2026 15:45
@backportbot backportbot Bot added bug 3. to review Waiting for reviews AI assisted labels Aug 13, 2026
@backportbot backportbot Bot added this to the Nextcloud 33.0.8 milestone Aug 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants