{"action":"created","issue":{"url":"https://api.github.com/repos/itsgoingd/clockwork/issues/233","repository_url":"https://api.github.com/repos/itsgoingd/clockwork","labels_url":"https://api.github.com/repos/itsgoingd/clockwork/issues/233/labels{/name}","comments_url":"https://api.github.com/repos/itsgoingd/clockwork/issues/233/comments","events_url":"https://api.github.com/repos/itsgoingd/clockwork/issues/233/events","html_url":"https://github.com/itsgoingd/clockwork/issues/233","id":298440753,"number":233,"title":"\"MIME type ('text/html') is not executable, and strict MIME type checking is enabled\" in Chrome 64","user":{"login":"sleavitt","id":76140,"avatar_url":"https://avatars2.githubusercontent.com/u/76140?v=4","gravatar_id":"","url":"https://api.github.com/users/sleavitt","html_url":"https://github.com/sleavitt","followers_url":"https://api.github.com/users/sleavitt/followers","following_url":"https://api.github.com/users/sleavitt/following{/other_user}","gists_url":"https://api.github.com/users/sleavitt/gists{/gist_id}","starred_url":"https://api.github.com/users/sleavitt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sleavitt/subscriptions","organizations_url":"https://api.github.com/users/sleavitt/orgs","repos_url":"https://api.github.com/users/sleavitt/repos","events_url":"https://api.github.com/users/sleavitt/events{/privacy}","received_events_url":"https://api.github.com/users/sleavitt/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-02-20T00:53:22Z","updated_at":"2018-02-20T11:00:47Z","closed_at":null,"author_association":"NONE","body":"The web view does not take into account the correct mime type for .js files in Clockwork\\Web\\Web (it only has a check for paths containing .css in them, but not .js), causing them to be served up with mime type 'text/html', and Chrome 64 refuses to execute them due to strict mime type checking.\r\n\r\nThis is easily fixed by amending the asset() method to read something like the following:\r\n\r\n```php\r\n        public function asset($path)\r\n        {\r\n                $path = $this->resolveAssetPath($path);\r\n\r\n                if (! $path) return;\r\n\r\n                switch (pathinfo($path, PATHINFO_EXTENSION)) {\r\n                        case 'css':\r\n                                $mime = 'text/css';\r\n                                break;\r\n                        case 'js':\r\n                                $mime = 'application/javascript';\r\n                                break;\r\n                        default:\r\n                                $mime = 'text/html';\r\n                                break;\r\n                }\r\n\r\n                return [\r\n                        'path' => $path,\r\n                        'mime' => $mime\r\n                ];\r\n        }\r\n```\r\n\r\nI'm sure there are other ways that could be written, but the mime type should be based on the ending extension of the path IMO. I modified the method to read as above and it worked fine for me on PHP 7 and I am no longer experiencing errors in the Chrome console due to strict MIME type checking on .js files from Clockwork."},"comment":{"url":"https://api.github.com/repos/itsgoingd/clockwork/issues/comments/366942208","html_url":"https://github.com/itsgoingd/clockwork/issues/233#issuecomment-366942208","issue_url":"https://api.github.com/repos/itsgoingd/clockwork/issues/233","id":366942208,"user":{"login":"itsgoingd","id":821582,"avatar_url":"https://avatars1.githubusercontent.com/u/821582?v=4","gravatar_id":"","url":"https://api.github.com/users/itsgoingd","html_url":"https://github.com/itsgoingd","followers_url":"https://api.github.com/users/itsgoingd/followers","following_url":"https://api.github.com/users/itsgoingd/following{/other_user}","gists_url":"https://api.github.com/users/itsgoingd/gists{/gist_id}","starred_url":"https://api.github.com/users/itsgoingd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/itsgoingd/subscriptions","organizations_url":"https://api.github.com/users/itsgoingd/orgs","repos_url":"https://api.github.com/users/itsgoingd/repos","events_url":"https://api.github.com/users/itsgoingd/events{/privacy}","received_events_url":"https://api.github.com/users/itsgoingd/received_events","type":"User","site_admin":false},"created_at":"2018-02-20T11:00:47Z","updated_at":"2018-02-20T11:00:47Z","author_association":"OWNER","body":"Nice, do you want to PR this change?"}}
{"actor":{"display_login":"itsgoingd"}}