mapbox/millstone — Issue #19: support remote datasource urls without extensions via `content-disposition`
Author: springmeyer
Created: 2011-10-11 19:46:54+00:00
State: open

Frequently urls to geojson don't end with an extension of .json or .geojson. Also csv files remotely hosted at google docs also present this issue:

```
https://docs.google.com/spreadsheet/pub?hl=en_US&hl=en_US&key=0AqV4OJpywingdFNYLXpKMmxqMG1lWTJzNE45ZUVnNlE&single=true&gid=0&output=csv
```

Without the ability to detect the type of the file then tilemill is unable to tell mapnik which datasource plugin to use to read it, eg `ogr` for .geojson files and `csv` for .csv files.

So, we need to find more robust ways to support this. One approach in TileMill may be to detect urls without an obvious extension and then require the user to supply the type of file, but good api's will set the `content-disposition` from which a filename and extension can be pulled.

It should be easy to get the `content-disposition` during `download()`

```
if (!path.extname(filepath)
&& response.headers
&& response.headers['content-disposition']) {
var disp = response.headers['content-disposition'];
var match = disp.match(/^.*filename="(.*)"/i);
if (match[1]) {
filepath = path.join(filepath,match[1]);
}
}
```

But our caching framework will still likely break because we call `path.extname(uri.pathname)` in several places.