-
-
Notifications
You must be signed in to change notification settings - Fork 866
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
GZip Google Storages Stores With .csv.gz Ending #1454
Comments
I think if I added
I think that would do it. |
I don't know if what I posted above is the exact correct solution. The root cause is https://github.com/jschneier/django-storages/blob/master/storages/backends/gcloud.py#L41 where >>> import mimetypes
>>> mimetypes.guess_type("c.csv")
('text/csv', None)
>>> mimetypes.guess_type("c.csv.gz")
('text/csv', 'gzip') even though That The problem is the desired name for my file on GCS is One more potential solution is to not guess based on the name but instead actually check what Another potential solution is: self.gzip
and upload_params[CONTENT_TYPE] in self.gzip_content_types
and (CONTENT_ENCODING not in blob_params or blob_params[CONTENT_ENCODING] is None) |
Wow I was totally off base. The file was getting stored gzipped in GCS. Per this SO thread though, it automatically decompresses it on download: https://stackoverflow.com/questions/67744979/how-to-prevent-gcs-from-automatically-decompressing-objects-when-using-python-sd. |
Hello,
When GZIP compressing a
text/csv
file, with the GCS Backend, it saves it asType
text/csv
with a.csv
ending. This leads to the OS believing that it's a CSV when downloaded when in actuality it is a GZipped CSV.Current behavior:
Type
text/csv
.csv
endingDesired behavior:
Type
application/octet-stream
.csv.gz
endingHow do I go about fixing this? I am willing to make a contribution if you'd like. I just need some guidance.
Thank you!
The text was updated successfully, but these errors were encountered: