{"action":"created","issue":{"url":"https://api.github.com/repos/CartoDB/cartodb/issues/4389","labels_url":"https://api.github.com/repos/CartoDB/cartodb/issues/4389/labels{/name}","comments_url":"https://api.github.com/repos/CartoDB/cartodb/issues/4389/comments","events_url":"https://api.github.com/repos/CartoDB/cartodb/issues/4389/events","html_url":"https://github.com/CartoDB/cartodb/pull/4389","id":94100765,"number":4389,"title":"Check for csv named as xls or xlsx and try to parse it correctly","user":{"login":"ethervoid","id":741240,"avatar_url":"https://avatars.githubusercontent.com/u/741240?v=3","gravatar_id":"","url":"https://api.github.com/users/ethervoid","html_url":"https://github.com/ethervoid","followers_url":"https://api.github.com/users/ethervoid/followers","following_url":"https://api.github.com/users/ethervoid/following{/other_user}","gists_url":"https://api.github.com/users/ethervoid/gists{/gist_id}","starred_url":"https://api.github.com/users/ethervoid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ethervoid/subscriptions","organizations_url":"https://api.github.com/users/ethervoid/orgs","repos_url":"https://api.github.com/users/ethervoid/repos","events_url":"https://api.github.com/users/ethervoid/events{/privacy}","received_events_url":"https://api.github.com/users/ethervoid/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-07-09T16:56:16Z","updated_at":"2015-07-10T08:46:08Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/CartoDB/cartodb/pulls/4389","html_url":"https://github.com/CartoDB/cartodb/pull/4389","diff_url":"https://github.com/CartoDB/cartodb/pull/4389.diff","patch_url":"https://github.com/CartoDB/cartodb/pull/4389.patch"},"body":"**This PR fixes #4271**\r\n\r\n**Context**\r\n\r\nWe receive a file `file.csv` but the request comes with a `Content-Type: application/vnd.ms-excel`. When the user try to import it fails.\r\n\r\n**Error**\r\n\r\nThe problem is that try to use `in2csv` but believing that is a `xls` file. `in2csv` gives an error when try to convert it to `csv` because the file doesn't have the BOF header.\r\n\r\n**Solution**\r\n\r\nGet the mime-type of the file and if that type is `text/plain` we assume that is a `csv` file and try to convert using `-f csv` flag\r\n\r\nPlease @CartoDB/backend take a look to it. Thank you :)\r\n"},"comment":{"url":"https://api.github.com/repos/CartoDB/cartodb/issues/comments/120303061","html_url":"https://github.com/CartoDB/cartodb/pull/4389#issuecomment-120303061","issue_url":"https://api.github.com/repos/CartoDB/cartodb/issues/4389","id":120303061,"user":{"login":"Kartones","id":2085449,"avatar_url":"https://avatars.githubusercontent.com/u/2085449?v=3","gravatar_id":"","url":"https://api.github.com/users/Kartones","html_url":"https://github.com/Kartones","followers_url":"https://api.github.com/users/Kartones/followers","following_url":"https://api.github.com/users/Kartones/following{/other_user}","gists_url":"https://api.github.com/users/Kartones/gists{/gist_id}","starred_url":"https://api.github.com/users/Kartones/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kartones/subscriptions","organizations_url":"https://api.github.com/users/Kartones/orgs","repos_url":"https://api.github.com/users/Kartones/repos","events_url":"https://api.github.com/users/Kartones/events{/privacy}","received_events_url":"https://api.github.com/users/Kartones/received_events","type":"User","site_admin":false},"created_at":"2015-07-10T08:46:08Z","updated_at":"2015-07-10T08:46:08Z","body":"I am ok with making the importer smarter but, do we want to handle this user screw ups?\r\n\r\nI mean, if you provide a valid extension (CSV) but content doesn't maches, maybe we should just tell the user a simple \"wrong format\", which is the truth. Don't know, is the same as with encoding issues, we've taken the approach of \"if is not UTF-8 is your issue, not ours\".\r\n\r\nAnother point: Also, if we do this, then why not check all allowed types have correct content? We should generalize this check/solution (no matter we fix or return error) instead of only covering this xls to csv scenario no?\r\n\r\n/cc @iriberri @javisantana "}}