From b597fdc67d2bf8d99485e5d5148ccdfb33399cc6 Mon Sep 17 00:00:00 2001 From: lazerg Date: Wed, 4 Nov 2026 06:04:56 +0500 Subject: [PATCH 1/2] fix(files): import finfo in mimetype detection Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: lazerg --- lib/private/Files/Type/Detection.php | 1 + tests/lib/Files/Type/DetectionTest.php | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/lib/private/Files/Type/Detection.php b/lib/private/Files/Type/Detection.php index 35fec9c230f16..e16cfa52d728c 100644 --- a/lib/private/Files/Type/Detection.php +++ b/lib/private/Files/Type/Detection.php @@ -9,6 +9,7 @@ namespace OC\Files\Type; +use finfo; use OCP\Files\IMimeTypeDetector; use OCP\IBinaryFinder; use OCP\ITempManager; diff --git a/tests/lib/Files/Type/DetectionTest.php b/tests/lib/Files/Type/DetectionTest.php index 3d555fbcef46c..84d3ff4d164f8 100644 --- a/tests/lib/Files/Type/DetectionTest.php +++ b/tests/lib/Files/Type/DetectionTest.php @@ -103,6 +103,11 @@ public function testDetectString(): void { $this->assertEquals($expected, $result); } + public function testDetectStringIcon(): void { + $result = $this->detection->detectString(file_get_contents(\OC::$SERVERROOT . '/tests/data/media/image.ico')); + $this->assertEquals('image/vnd.microsoft.icon', $result); + } + public static function dataMimeTypeCustom(): array { return [ ['123', 'foobar/123'], From 350adbac58d1925e80312c56eaa36a490729af04 Mon Sep 17 00:00:00 2001 From: Josh Date: Sat, 14 Nov 2026 12:02:41 -0500 Subject: [PATCH 2/2] test(files): adjust mime detection icon test for --- tests/lib/Files/Type/DetectionTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/lib/Files/Type/DetectionTest.php b/tests/lib/Files/Type/DetectionTest.php index 84d3ff4d164f8..bb4402960a70b 100644 --- a/tests/lib/Files/Type/DetectionTest.php +++ b/tests/lib/Files/Type/DetectionTest.php @@ -104,7 +104,7 @@ public function testDetectString(): void { } public function testDetectStringIcon(): void { - $result = $this->detection->detectString(file_get_contents(\OC::$SERVERROOT . '/tests/data/media/image.ico')); + $result = $this->detection->detectString(file_get_contents(\OC::$SERVERROOT . '/core/img/favicon.ico')); $this->assertEquals('image/vnd.microsoft.icon', $result); }