Skip to content

fix(files_sharing): validate input in PublicPreviewController#getPreview#61960

Open
kesselb wants to merge 3 commits into
masterfrom
bug-59229
Open

fix(files_sharing): validate input in PublicPreviewController#getPreview#61960
kesselb wants to merge 3 commits into
masterfrom
bug-59229

Conversation

@kesselb

@kesselb kesselb commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Fixes #59229

Summary

Local version of #59253

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.

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

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: Claude:claude-opus-4-6

Signed-off-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
@kesselb kesselb added this to the Nextcloud 35 milestone Jul 9, 2026
@kesselb kesselb self-assigned this Jul 9, 2026
@kesselb kesselb requested review from a team and provokateurin as code owners July 9, 2026 20:10
@kesselb kesselb added the bug label Jul 9, 2026
@kesselb kesselb requested review from ArtificialOwl and removed request for a team July 9, 2026 20:10
@kesselb kesselb added the 3. to review Waiting for reviews label Jul 9, 2026
@kesselb kesselb requested review from come-nc and leftybournes July 9, 2026 20:10
@kesselb kesselb added 2. developing Work in progress and removed 3. to review Waiting for reviews labels Jul 9, 2026
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.

[Bug]: Improper input validation in PublicPreviewController triggers internal server error

3 participants