Skip to content

fix(files): import finfo in mimetype detection - #66246

Merged
susnux merged 1 commit into
nextcloud:masterfrom
lazerg:fix/issue-66239-detection-finfo
Nov 5, 2026
Merged

susnux merged 1 commit into
nextcloud:masterfrom
lazerg:fix/issue-66239-detection-finfo

Conversation

@lazerg

@lazerg lazerg commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Detection.php lives in OC\Files\Type but never imported finfo, so class_exists(finfo::class) checked OC\Files\Type\finfo and was always false. detectString() then fell back to the temp file path, where getSecureMimeType() turned types like image/vnd.microsoft.icon into application/octet-stream. Adding use finfo; brings back the finfo path from before #54077. I also added a test that runs detectString() on an .ico file.

Checklist

AI (if applicable)

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

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: lazerg <lazerg2@gmail.com>
@lazerg
lazerg requested a review from a team as a code owner November 4, 2026 01:05
@lazerg
lazerg requested review from CarlSchwan and salmart-dev and removed request for a team November 4, 2026 01:05
@susnux susnux added bug 3. to review Waiting for reviews feature: files team: Files Code maintained by 📁 Files team labels Nov 5, 2026
@susnux susnux added this to the Nextcloud 36 milestone Nov 5, 2026
@susnux
susnux merged commit 090e5dc into nextcloud:master Nov 5, 2026
169 of 174 checks passed
@welcome

welcome Bot commented Nov 5, 2026

Copy link
Copy Markdown

Thanks for your first pull request and welcome to the community! Feel free to keep them coming! If you are looking for issues to tackle then have a look at this selection: https://github.com/nextcloud/server/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22

@susnux

susnux commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

/backport to stable35

@github-actions

Copy link
Copy Markdown
Contributor

This pull request has been automatically locked because it has been closed for more than 7 days. As we do not monitor merged or closed pull requests, we are locking this pull request to prevent further comments from getting lost in the noise.
If you discovered any issues with this pull request, please open a new issue instead. In case you want to discuss this pull request or have further questions, please use our forum: https://help.nextcloud.com

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Nov 13, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

3. to review Waiting for reviews bug feature: files team: Files Code maintained by 📁 Files team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Detection::detectString() / detectContent() never use finfo – missing use finfo; (regression from #54077)

3 participants