{"action":"created","issue":{"url":"https://api.github.com/repos/rubenv/angular-gettext/issues/220","labels_url":"https://api.github.com/repos/rubenv/angular-gettext/issues/220/labels{/name}","comments_url":"https://api.github.com/repos/rubenv/angular-gettext/issues/220/comments","events_url":"https://api.github.com/repos/rubenv/angular-gettext/issues/220/events","html_url":"https://github.com/rubenv/angular-gettext/pull/220","id":106412907,"number":220,"title":"Check that loadRemote returns a Javascript object, not html","user":{"login":"scottrice10","id":3627116,"avatar_url":"https://avatars.githubusercontent.com/u/3627116?v=3","gravatar_id":"","url":"https://api.github.com/users/scottrice10","html_url":"https://github.com/scottrice10","followers_url":"https://api.github.com/users/scottrice10/followers","following_url":"https://api.github.com/users/scottrice10/following{/other_user}","gists_url":"https://api.github.com/users/scottrice10/gists{/gist_id}","starred_url":"https://api.github.com/users/scottrice10/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scottrice10/subscriptions","organizations_url":"https://api.github.com/users/scottrice10/orgs","repos_url":"https://api.github.com/users/scottrice10/repos","events_url":"https://api.github.com/users/scottrice10/events{/privacy}","received_events_url":"https://api.github.com/users/scottrice10/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-09-14T19:37:48Z","updated_at":"2015-09-15T13:27:23Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/rubenv/angular-gettext/pulls/220","html_url":"https://github.com/rubenv/angular-gettext/pull/220","diff_url":"https://github.com/rubenv/angular-gettext/pull/220.diff","patch_url":"https://github.com/rubenv/angular-gettext/pull/220.patch"},"body":"Problem: On our integration and production environments, our nginx config file redirects a user to index.html - our landing page - when a file is not found. This redirection returns a 200 http code. The loadRemote method in angular-gettext only checks for a successful http response, so it tries to parse our html as if it is JSON. This causes our app to crash when run in Firefox or Safari.\r\n\r\nSolution: This proposed change checks that the successful response from loadRemote is returning a Javascript object (JSON), rather than html, to prevent browser crashes."},"comment":{"url":"https://api.github.com/repos/rubenv/angular-gettext/issues/comments/140393071","html_url":"https://github.com/rubenv/angular-gettext/pull/220#issuecomment-140393071","issue_url":"https://api.github.com/repos/rubenv/angular-gettext/issues/220","id":140393071,"user":{"login":"gabegorelick","id":610129,"avatar_url":"https://avatars.githubusercontent.com/u/610129?v=3","gravatar_id":"","url":"https://api.github.com/users/gabegorelick","html_url":"https://github.com/gabegorelick","followers_url":"https://api.github.com/users/gabegorelick/followers","following_url":"https://api.github.com/users/gabegorelick/following{/other_user}","gists_url":"https://api.github.com/users/gabegorelick/gists{/gist_id}","starred_url":"https://api.github.com/users/gabegorelick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gabegorelick/subscriptions","organizations_url":"https://api.github.com/users/gabegorelick/orgs","repos_url":"https://api.github.com/users/gabegorelick/repos","events_url":"https://api.github.com/users/gabegorelick/events{/privacy}","received_events_url":"https://api.github.com/users/gabegorelick/received_events","type":"User","site_admin":false},"created_at":"2015-09-15T13:27:23Z","updated_at":"2015-09-15T13:27:23Z","body":"You might want to consider returning a 404 instead of a redirect. The 404\ncan include a body (in this case your landing page).\n\nBut I understand a lot of backend services can't always be changed, so I'm\nnot opposed to handling this case in angular-gettext.\n\nOn Monday, September 14, 2015, Scott Rice <notifications@github.com> wrote:\n\n> Problem: On our integration and production environments, our nginx config\n> file redirects a user to index.html - our landing page - when a file is not\n> found. This redirection returns a 200 http code. The loadRemote method in\n> angular-gettext only checks for a successful http response, so it tries to\n> parse our html as if it is JSON. This causes our app to crash when run in\n> Firefox or Safari.\n>\n> Solution: This proposed change checks that the successful response from\n> loadRemote is returning a Javascript object (JSON), rather than html, to\n> prevent browser crashes.\n> ------------------------------\n> You can view, comment on, or merge this pull request online at:\n>\n>   https://github.com/rubenv/angular-gettext/pull/220\n> Commit Summary\n>\n>    - Check that load remote returns a Javascript object, not html\n>\n> File Changes\n>\n>    - *M* dist/angular-gettext.js\n>    <https://github.com/rubenv/angular-gettext/pull/220/files#diff-0> (11)\n>\n> Patch Links:\n>\n>    - https://github.com/rubenv/angular-gettext/pull/220.patch\n>    - https://github.com/rubenv/angular-gettext/pull/220.diff\n>\n> —\n> Reply to this email directly or view it on GitHub\n> <https://github.com/rubenv/angular-gettext/pull/220>.\n>\n"}}