Repository: getsentry/sentry

Issue:
SVG static assets broken and not displayed
Every asset with svg type are displayed as broken in web interface.

![image](https://user-images.githubusercontent.com/776304/43769623-7422f776-9a3a-11e8-9e0d-d16691e1614c.png)

We installed sentry 9 with python and nginx as proxy on CentOS 7.2

When I look the content-type returned, svg files are not recognized.

```
$ curl -v https://sentry/_static/1533634345/sentry/dist/php.svg
(...)
< Content-Type: application/octet-stream
```

If I check the file on server, the svg is not recognized.

```
$ file php.svg 
php.svg: HTML document, ASCII text, with very long lines, with no line terminators
```

If we serve the file directly with nginx, the correct mime type is sent as _image/svg+xml_



Discussion:
I was also able reproduce this issue while used with nginx.

At first I was sure that this is a nginx issue, however doing curl directly on sentry service yields same result

```
# curl -I http://localhost:9000/_static/1533635880/sentry/dist/laravel.svg
HTTP/1.1 200 OK
Content-Length: 330
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
Vary: Accept-Encoding
Last-Modified: Tue, 07 Aug 2018 09:53:36 GMT
Cache-Control: max-age=315360000
X-Frame-Options: deny
Content-Type: application/octet-stream
```

For me at the end issue was missing mailcap package and default /etc/mime.types
This is actually an uwsgi issue not sentry per-se, it is related with this: 
https://github.com/unbit/uwsgi/issues/1847

Interesting. We can fix this in Sentry though, but it seems your system's default stuff isn't detecting svg as a proper type.

So we can just add an entry into here: https://github.com/getsentry/sentry/blob/master/src/sentry/runner/settings.py#L100-L109

To be overly explicit.
@mattrobenolt I added the "missing" svg mime type in this file and I confirm that works.

Indeed, the solution given by @modulec, install the mailcap package, works too. 

But if nothing is done, Sentry on CentOS 7 doesn't display any svg graphic.
Hi @dgaussin,

I have also installed Sentry in Centos and have been facing the same issue.

can you please guide me adding the "missing" SVG mime type in mime.type file.

Thanks
It’s seems like you can install the `mailcap` package.

But this bears repeating since you keep ignoring it: we do not support CentOS. 
@mattrobenolt, @dgaussin mentioned that he added the missing SVG mime type and said its working !! So, I was kind of asking him how to do it.

Resolving patch:
diff --git a/src/sentry/runner/settings.py b/src/sentry/runner/settings.py
--- a/src/sentry/runner/settings.py
+++ b/src/sentry/runner/settings.py
@@ -101,10 +101,14 @@ def configure(ctx, py, yaml, skip_service_validation=False):
     # which aren't common in default system registries
     import mimetypes
     for type, ext in (
-        ('application/json', 'map'), ('application/font-woff', 'woff'),
-        ('application/font-woff2', 'woff2'), ('application/vnd.ms-fontobject', 'eot'),
-        ('application/x-font-ttf', 'ttf'), ('application/x-font-ttf',
-                                            'ttc'), ('font/opentype', 'otf'),
+        ('application/json', 'map'),
+        ('application/font-woff', 'woff'),
+        ('application/font-woff2', 'woff2'),
+        ('application/vnd.ms-fontobject', 'eot'),
+        ('application/x-font-ttf', 'ttf'),
+        ('application/x-font-ttf', 'ttc'),
+        ('font/opentype', 'otf'),
+        ('image/svg+xml', 'svg'),
     ):
         mimetypes.add_type(type, '.' + ext)
 


Test patch: