[Bug]: Detection::detectString() / detectContent() never use finfo – missing use finfo; (regression from #54077)
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 1/5
- Tempo stimato
- Meno di un'ora
- Idoneità per principianti
- 62/100
Direzione di ricerca
Inizia da lib/private/Files/Type/Detection.php, dove detectContent() e detectString() fanno riferimento a finfo::class e new finfo(...) senza un import use finfo;, quindi la ricerca si risolve in OC\Files\Type\finfo. Aggiungi l'import globale mancante e verifica che il ramo finfo venga eseguito quando ext-fileinfo è caricata. È completato quando detectString() restituisce image/vnd.microsoft.icon invece di application/octet-stream per i byte del favicon.ico di heise.de.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
⚠️ This issue respects the following points: ⚠️
- This is not a troubleshooting question, general support matter, or webserver/proxy problem, but likely a bug (if unsure, ask the Community Help Forum).
- This issue is not already reported on Github OR solved at the Community Help Forum (I've searched!).
- I'm using a maintained major version of Nextcloud Server and tested against the latest patch level. (Supported major versions and current patch levels).
- I agree to follow Nextcloud's Code of Conduct.
- I've tried my best to provide clear reproduction steps that someone unfamiliar with this bug could use to reproduce it.
Bug description
Since #54077 (refactor(IMimeTypeDetector): streamline finfo usage + misc tidying), lib/private/Files/Type/Detection.php uses class_exists(finfo::class) and new finfo(...). The file is in namespace OC\Files\Type, but there is no use finfo; import. finfo::class therefore resolves to OC\Files\Type\finfo, class_exists() is always false, and the finfo branch never runs, even when ext-fileinfo is loaded.
Affected: detectString() (line ~302) and detectContent() (line ~228). Present in v35.0.2, stable34, stable35 and master.
Effect: detectString() falls back to writing a temp file and calling detect() → detectContent() → mime_content_type(). That result goes through getSecureMimeType(), which maps MIME types that are not in the mimetype list (e.g. image/vnd.microsoft.icon) to application/octet-stream. Before the refactor, finfo_buffer() returned the real type.
Visible consequence: In the Mail app, favicon avatars no longer show up. FaviconSource calls IMimeTypeDetector::detectString(), gets application/octet-stream for .ico favicons, and AvatarService::hasAllowedMime() rejects the result. I suspect this is also why FaviconSourceTest::testFetchNoCacheFiles was dropped as "flaky" in nextcloud/mail#12578.
Steps to reproduce
<?php
require 'lib/base.php';
$d = \OCP\Server::get(\OCP\Files\IMimeTypeDetector::class);
$ico = file_get_contents('https://heise.de/favicon.ico');
var_dump(class_exists('OC\Files\Type\finfo')); // false
var_dump($d->detectString($ico)); // "application/octet-stream"
var_dump((new \finfo(FILEINFO_MIME_TYPE))->buffer($ico)); // "image/vnd.microsoft.icon"
Expected behavior
detectString() returns image/vnd.microsoft.icon, as it did before #54077.
Nextcloud Server version
35
Operating system
Debian/Ubuntu
PHP engine version
PHP 8.4
Web server
Nginx
Database engine version
PostgreSQL
Is this bug present after an update or on a fresh install?
None
Are you using the Nextcloud Server Encryption module?
Encryption is Disabled
What user-backends are you using?
- Default user-backend (database)
- LDAP/ Active Directory
- SSO - SAML
- Other
Configuration report
List of activated Apps
Nextcloud Signing status
Nextcloud Logs
Additional info
No response
- Lingua principale
- PHP
- Stelle
- 37.3k
- Fork
- 5.3k
- Merge medio
- 2g 14h
- PR unite (30g)
- 636
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di nextcloud/server
-
[Bug]: DAV Forbidden/InvalidPath responses break on "&" in the message (DOMDocument::createElementNS(): unterminated entity reference)Forse già presa @th-joerger l’ha presa 1 giorno fa. Aperta0. Needs triage 35-feedback bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno
-
[Bug]: Files folder-tree API eagerly lists the children of every subfolder at the last requested depth, then discards them (N extra directory listings per request)Forse già presa @lazerg l’ha presa 3 giorni fa. Aperta0. Needs triage 34-feedback bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
nextcloud/server#65904 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug]: Contradictory notifications when cancelling welcome email confirmationForse già presa @Jashan32 l’ha presa 5 giorni fa. Aperta0. Needs triage 36-feedback bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
I maintainer di solito rispondono entro 1 giorno
-
`OutOfOfficeEventDispatcherJob` is not cleaned up correctlyForse già presa @MishowHD l’ha presa 4 giorni fa. Aperta1. to develop bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di nextcloud/server
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
getgrav/grav-plugin-api#74 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
heroku/heroku-buildpack-php#1024 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
PHPOffice/PhpSpreadsheet#5091 ·
I maintainer di solito rispondono entro 3 giorni