Skip to content

Commit

Permalink
added image/svg MIME support
Browse files Browse the repository at this point in the history
  • Loading branch information
0xb4lint committed Oct 8, 2019
1 parent b2062b9 commit c7238f7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion MimeTypes.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand Down Expand Up @@ -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'],
Expand Down
4 changes: 4 additions & 0 deletions Tests/MimeTypesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
}

Expand All @@ -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'));
}
}

0 comments on commit c7238f7

Please sign in to comment.