{"action":"created","issue":{"url":"https://api.github.com/repos/mrdoob/three.js/issues/10363","repository_url":"https://api.github.com/repos/mrdoob/three.js","labels_url":"https://api.github.com/repos/mrdoob/three.js/issues/10363/labels{/name}","comments_url":"https://api.github.com/repos/mrdoob/three.js/issues/10363/comments","events_url":"https://api.github.com/repos/mrdoob/three.js/issues/10363/events","html_url":"https://github.com/mrdoob/three.js/pull/10363","id":195761756,"number":10363,"title":"Fix Loading an SVG with TextureLoader","user":{"login":"kevanstannard","id":937077,"avatar_url":"https://avatars.githubusercontent.com/u/937077?v=3","gravatar_id":"","url":"https://api.github.com/users/kevanstannard","html_url":"https://github.com/kevanstannard","followers_url":"https://api.github.com/users/kevanstannard/followers","following_url":"https://api.github.com/users/kevanstannard/following{/other_user}","gists_url":"https://api.github.com/users/kevanstannard/gists{/gist_id}","starred_url":"https://api.github.com/users/kevanstannard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kevanstannard/subscriptions","organizations_url":"https://api.github.com/users/kevanstannard/orgs","repos_url":"https://api.github.com/users/kevanstannard/repos","events_url":"https://api.github.com/users/kevanstannard/events{/privacy}","received_events_url":"https://api.github.com/users/kevanstannard/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":11,"created_at":"2016-12-15T09:55:40Z","updated_at":"2016-12-17T22:58:39Z","closed_at":"2016-12-17T22:58:35Z","pull_request":{"url":"https://api.github.com/repos/mrdoob/three.js/pulls/10363","html_url":"https://github.com/mrdoob/three.js/pull/10363","diff_url":"https://github.com/mrdoob/three.js/pull/10363.diff","patch_url":"https://github.com/mrdoob/three.js/pull/10363.patch"},"body":"The problem appears to be happening in the `ImageLoader` when converting the loaded SVG blob into a URL and then making it the src of an image:\r\n\r\n~~~js\r\nimage.src = URL.createObjectURL( blob );\r\n~~~\r\n\r\nWith the current code we override the server provided MIME type with `text/plain` (which ends up in `blob.type`).\r\n\r\nFor some reason creating PNGs and JPGs with a MIME type of `text/plain` works. Perhaps it's because it does not rely on the MIME type and instead derives it from the image binary content? Not sure, but with SVGs it results in an error.\r\n\r\nThis PR changes the behaviour so it only sets the overriding `text/plain` MIME type when not a blob. \r\n\r\nAt the moment only `ImageLoader` requests a blob type so this PR should only affect loading of images. All other loaders should continue to use the `text/plain` MIME type.\r\n\r\nUnfortunately I've been unable to reproduce errors/warnings reported by others in my dev environment, perhaps due to different local web servers, but hopefully this PR has a smaller impact that my previous PR (https://github.com/mrdoob/three.js/pull/10329)\r\n\r\nAs mentioned previously this should fix https://github.com/mrdoob/three.js/issues/9575\r\n"},"comment":{"url":"https://api.github.com/repos/mrdoob/three.js/issues/comments/267792501","html_url":"https://github.com/mrdoob/three.js/pull/10363#issuecomment-267792501","issue_url":"https://api.github.com/repos/mrdoob/three.js/issues/10363","id":267792501,"user":{"login":"mrdoob","id":97088,"avatar_url":"https://avatars.githubusercontent.com/u/97088?v=3","gravatar_id":"","url":"https://api.github.com/users/mrdoob","html_url":"https://github.com/mrdoob","followers_url":"https://api.github.com/users/mrdoob/followers","following_url":"https://api.github.com/users/mrdoob/following{/other_user}","gists_url":"https://api.github.com/users/mrdoob/gists{/gist_id}","starred_url":"https://api.github.com/users/mrdoob/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrdoob/subscriptions","organizations_url":"https://api.github.com/users/mrdoob/orgs","repos_url":"https://api.github.com/users/mrdoob/repos","events_url":"https://api.github.com/users/mrdoob/events{/privacy}","received_events_url":"https://api.github.com/users/mrdoob/received_events","type":"User","site_admin":false},"created_at":"2016-12-17T22:58:39Z","updated_at":"2016-12-17T22:58:39Z","body":"Thanks!"}}
{"actor":{"display_login":"mrdoob"}}