From c7238f7732e267f302422d75a2f118c9aeb28f89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ba=CC=81lint=20Szekeres?= Date: Tue, 8 Oct 2019 14:15:27 +0200 Subject: [PATCH] added image/svg MIME support --- MimeTypes.php | 3 ++- Tests/MimeTypesTest.php | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/MimeTypes.php b/MimeTypes.php index 6b5ad49..268658d 100644 --- a/MimeTypes.php +++ b/MimeTypes.php @@ -1251,6 +1251,7 @@ public function guessMimeType(string $path): ?string 'image/psd' => ['psd'], 'image/rle' => ['rle'], 'image/sgi' => ['sgi'], + 'image/svg' => ['svg'], 'image/svg+xml' => ['svg', 'svgz'], 'image/svg+xml-compressed' => ['svgz'], 'image/tiff' => ['tiff', 'tif'], @@ -2808,7 +2809,7 @@ public function guessMimeType(string $path): ?string 'sv4crc' => ['application/x-sv4crc'], 'svc' => ['application/vnd.dvb.service'], 'svd' => ['application/vnd.svd'], - 'svg' => ['image/svg+xml'], + 'svg' => ['image/svg+xml', 'image/svg'], 'svgz' => ['image/svg+xml', 'image/svg+xml-compressed'], 'svh' => ['text/x-svhdr'], 'swa' => ['application/x-director'], diff --git a/Tests/MimeTypesTest.php b/Tests/MimeTypesTest.php index c5ff262..a736dbe 100644 --- a/Tests/MimeTypesTest.php +++ b/Tests/MimeTypesTest.php @@ -47,6 +47,8 @@ public function testGetExtensions() $mt = new MimeTypes(); $this->assertSame(['mbox'], $mt->getExtensions('application/mbox')); $this->assertSame(['ai', 'eps', 'ps'], $mt->getExtensions('application/postscript')); + $this->assertContains('svg', $mt->getExtensions('image/svg+xml')); + $this->assertContains('svg', $mt->getExtensions('image/svg')); $this->assertSame([], $mt->getExtensions('application/whatever-symfony')); } @@ -56,6 +58,8 @@ public function testGetMimeTypes() $this->assertSame(['application/mbox'], $mt->getMimeTypes('mbox')); $this->assertContains('application/postscript', $mt->getMimeTypes('ai')); $this->assertContains('application/postscript', $mt->getMimeTypes('ps')); + $this->assertContains('image/svg+xml', $mt->getMimeTypes('svg')); + $this->assertContains('image/svg', $mt->getMimeTypes('svg')); $this->assertSame([], $mt->getMimeTypes('symfony')); } }