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

Copy from Cache To Store Strips Content Type #36

Closed
curreta opened this issue Aug 4, 2019 · 5 comments
Closed

Copy from Cache To Store Strips Content Type #36

curreta opened this issue Aug 4, 2019 · 5 comments

Comments

@curreta
Copy link

curreta commented Aug 4, 2019

The original image is successfully being stored in the 'cache' storage, and subsequently when it comes time to upload, it makes it successfully to the copy method

However, the original file that gets copied over to the main 'store' storage will lose it's Content Type.

I tested using the copy functionality directly using the google-cloud-storage gem. The content type remains.

I have been unable to track down the issue.

Screenshot_2019-08-03 Bucket details - ResidentHaven - Google Cloud Platform

Update 1
I was able to narrow it down by deleting this do loop - It appears those options are overwriting the content type.

Update 2
Setting any custom headers as described on the readme will cause the content-type to be emptied

Shrine::Storage::GoogleCloudStorage.new(
  bucket: "store",
  default_acl: 'publicRead',
  object_options: {
    cache_control: 'public, max-age: 7200'
  },
)
@renchap
Copy link
Owner

renchap commented Oct 21, 2019

Thanks for this report. I am not sure why setting those additional attributes removes the content type, I will try to troubleshoot this.

@renchap
Copy link
Owner

renchap commented Oct 21, 2019

This is a bug in the google-cloud-storage gem. I filled a bug on their repo: googleapis/google-cloud-ruby#4254

renchap added a commit that referenced this issue Oct 21, 2019
This is a workaround due to googleapis/google-cloud-ruby#4254
It should not have any visible impact as it does not create any additional request.

Also added a test for uploading from an existing GCS file, ensuring this is correctly fixed.

Fixes #36
@renchap
Copy link
Owner

renchap commented Oct 21, 2019

I just released 2.0.1 with a workaround for this issue, until this is fixed upstream.

@quartzmo
Copy link

I have opened PR googleapis/google-cloud-ruby#4275 to fix this issue in general in google-cloud-storage. Please take a look, comments welcome.

@quartzmo
Copy link

quartzmo commented Nov 12, 2019

Fix released in google-cloud-storage v1.24.0.

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

No branches or pull requests

3 participants