Skip to content

Commit

Permalink
Charset for SVG
Browse files Browse the repository at this point in the history
  • Loading branch information
Simbiat committed Jun 29, 2021
1 parent 309a61d commit e168d6d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/HTTP20/Sharing.php
Original file line number Diff line number Diff line change
Expand Up @@ -856,7 +856,7 @@ public function fileEcho(string $filepath, array $allowedMime = [], string $cach
#Send Last Modified, eTag and Cache-Control headers
(new Headers)->lastModified(filemtime($filepath), true)->eTag(hash_file('sha3-256', $filepath), true)->cacheControl('', $cacheStrat, true);
#Send MIME types. Add Charset to those, that are recommended to have it
if (preg_match('/^(text\/.*)|(application\/(.*javascript|.*json|.*xml))$/i', $mimeType) === 1) {
if (preg_match('/^(text\/.*)|(image\/svg\+xml)|(application\/(.*javascript|.*json|.*xml))$/i', $mimeType) === 1) {
header('Content-Type: '.$mimeType.'; charset=utf-8');
} else {
header('Content-Type: '.$mimeType);
Expand Down

0 comments on commit e168d6d

Please sign in to comment.