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

Server returns corrupted .gzipped files #75

Open
billyc opened this issue Jan 29, 2019 · 3 comments
Open

Server returns corrupted .gzipped files #75

billyc opened this issue Jan 29, 2019 · 3 comments
Assignees
Labels
bug Something isn't working file-server

Comments

@billyc
Copy link
Collaborator

billyc commented Jan 29, 2019

In the UI code, FileAPI.downloadFile() returns the correct blobs for any file OTHER THAN a gzipped file.

Gzipped files are returned with extra bytes somehow; they are corrupted and un-gunzippable.

This could likely be some sort of NGINX interaction problem.

@billyc
Copy link
Collaborator Author

billyc commented Jan 29, 2019

Reference matsim-org/viz#95

@billyc
Copy link
Collaborator Author

billyc commented Jan 29, 2019

The file is definitely "double gzipped".

If I gunzip it once as a binary array of bytes, and then gunzip that result a second time and specifically force it to decode that as a string, I can recover the contents.

const gzdata: any = await BlobUtil.blobToArrayBuffer(blob)
const gunzip1 = pako.inflate(gzdata)
const gunzip2 = pako.inflate(gunzip1, { to: 'string' })

console.log(gunzip2)  // <?xml version 1... etc>

@billyc
Copy link
Collaborator Author

billyc commented Jan 30, 2019

Dropwizard defaults to gzipping things on the fly.

Chrome and Firefox are handling this differently: firefox returns a "double-gzipped" blob whereas Chrome is providing a singly-gzipped blob.

By turning off gzip in Dropwizard, the two browsers both end up with a once-gzipped file.

@Janekdererste is going to explore more fine-grained settings for Dropwizard so that both browsers behave properly, and we don't have to double-unzip everything, and text files still get gzipped for efficiency.

@Janekdererste Janekdererste added the bug Something isn't working label Apr 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working file-server
Projects
None yet
Development

No branches or pull requests

2 participants