Skip to content

Exporting tables of non-org users always result in public.ext name #271

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
rafatower opened this issue Feb 18, 2016 · 2 comments
Open
Assignees
Labels

Comments

@rafatower
Copy link
Contributor

How to reproduce:

Expected: the name of the downloaded file is set to whosonfirst_region.csv or sth related to the exported table.

Actual: the downloaded file is set to public.csv.

The thing is that the Content-Disposition header sets the filename to public.csv:

$ curl -vv -X HEAD "https://observatory.cartodb.com/api/v2/sql?filename="public.whosonfirst_region"&q=SELECT+*+FROM+(select+*+from+public.whosonfirst_region)+as+subq+&format=csv&bounds=&api_key=&skipfields=the_geom_webmercator"
...
> HEAD /api/v2/sql?filename=public.whosonfirst_region&q=SELECT+*+FROM+(select+*+from+public.whosonfirst_region)+as+subq+&format=csv&bounds=&api_key=&skipfields=the_geom_webmercator HTTP/1.1
> User-Agent: curl/7.35.0
> Host: observatory.cartodb.com
> Accept: */*
> 
< HTTP/1.1 200 OK
* Server openresty is not blacklisted
< Server: openresty
< Date: Thu, 18 Feb 2016 12:11:26 GMT
< Content-Type: text/csv; charset=utf-8; header=present
< Content-Length: 63677977
< Connection: keep-alive
< Vary: Accept-Encoding
< Access-Control-Allow-Origin: *
< Access-Control-Allow-Headers: X-Requested-With, X-Prototype-Version, X-CSRF-Token
< Content-Disposition: attachment; filename=public.csv; modification-date="Thu, 18 Feb 2016 12:01:07 GMT";
< Cache-Control: no-cache,max-age=31536000,must-revalidate,public
< Last-Modified: Mon, 01 Feb 2016 22:13:32 GMT
< X-SQLAPI-Profiler: {"queryExplain":5,"generate":493,"beforeSink":1,"total":499}
< X-Varnish: 1771113958 1771043295
< Age: 619
< X-Cache: HIT

Related to CartoDB/cartodb#6609

@iriberri
Copy link

I rechecked the HEAD request to the URL and saw that the underscore is coming directly with the tablename in the Content-Disposition:

image

It seems that some browsers or tools (like Postman or Typhoeus) are doing these things. I see that if in the filename parameter of the URL you get rid of points and quotes, the name of the downloaded file is just "public", but the quotes are giving me _public or _public_ in Chrome, Typhoeus and Postman.

@rochoa
Copy link
Contributor

rochoa commented Feb 22, 2016

We can improve the name formatting for filenames but providing a different filename param with the desired name should do the trick, and that's something the client is controlling on this case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants