Skip to content
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

Change csv attachment name to use '__' instead of ',' #76

Merged
merged 1 commit into from
Oct 24, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ Current

### Changed:

- [CSV attachment name for multi-interval request now contain '__' instead of ','](https://github.com/yahoo/fili/pull/76)
- This change is made to allow running multi-api request with csv format using chrome browser.

- [Allow configurable headers for Druid data requests](https:://github.com/yahoo/fili/pull/62)
- The `AsyncDruidWebServiceImpl` now accepts a `Supplier<Map<String, String>>` argument which specifies
the headers to add to the Druid data requests. This feature is made configurable through `SystemConfig` in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ public static String getCsvContentDispositionValue(UriInfo uriInfo) {
if (interval == null) {
interval = "";
} else {
interval = "_" + interval.replace("/", "_");
// Chrome treats ',' as duplicate header so replace it with '__' to make chrome happy.
interval = "_" + interval.replace("/", "_").replace(",", "__");
}

return "attachment; filename=" + uriPath + interval + ".csv";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class HttpResponseMakerSpec extends Specification {

responseContext = new ResponseContext(apiRequest.dimensionFields)

paramMap.getFirst("dateTime") >> "a/b"
paramMap.getFirst("dateTime") >> "a/b,c/d"
pathSegment.getPath() >> "theMockPath"
uriInfo.getPathSegments() >>[pathSegment]
uriInfo.getQueryParameters() >> paramMap
Expand Down Expand Up @@ -127,7 +127,7 @@ class HttpResponseMakerSpec extends Specification {

then: "The header is set correctly"
actual.getHeaderString(HttpHeaders.CONTENT_TYPE) == "text/csv; charset=utf-8"
actual.getHeaderString(HttpHeaders.CONTENT_DISPOSITION) == "attachment; filename=theMockPath_a_b.csv"
actual.getHeaderString(HttpHeaders.CONTENT_DISPOSITION) == "attachment; filename=theMockPath_a_b__c_d.csv"

and: "Mock override: A CSV-formatted request"
apiRequest.getFormat() >> ResponseFormatType.CSV
Expand Down