mirror of
https://github.com/fsouza/fake-gcs-server.git
synced 2026-04-26 06:05:54 +03:00
[GH-ISSUE #1098] Content-Type being set incorrectly for resumable uploads. #166
Labels
No labels
bug
compatibility-issue
docker
documentation
enhancement
help wanted
needs information
pull-request
question
stale
unfortunate
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/fake-gcs-server#166
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @otherguy on GitHub (Mar 16, 2023).
Original GitHub issue: https://github.com/fsouza/fake-gcs-server/issues/1098
Hi!
First of all, thank you for developing this. It's an invaluable tool for local development :)
We are using the latest version (
1.44.0) with Ruby/Rails where the Google SDK always does resumable uploads.Generally, it's working well but the content type of all uploaded files is set to
application/json. This can be verified byexecing into the Docker container and runningattr(might have toapk --update addit first) on the file.Now this happens regardless of whether
content_typeis added to the original upload. Here is the output of the SDK with nocontent_typeparameter. As you can see, nocontent_typeis present in the initial upload, but the actual uploaded file ends up with a content type ofapplication/json.Now, as I mentioned, this even happens when you pass the correct
content_typeto the upload command.If we restart the GCS server and it reloads the files from disk, the content type is set correctly (again, can be verified by running
attron the file as well). I assume this is because of https://github.com/fsouza/fake-gcs-server/issues/531.It would however be great if the content type would also be correct for newly uploaded files, when using resumable uploads!
It looks like this was addressed in https://github.com/fsouza/fake-gcs-server/issues/532 and supposedly fixed in https://github.com/fsouza/fake-gcs-server/pull/924 but it does not seem to be working.
I also tried passing in the
ContentTypeviametadata, according to the fix mentioned here: #924.As you can see, the metadata is even saved correctly, but the actual
ContentTypeis still set toapplication/json.@otherguy commented on GitHub (May 3, 2023):
Hey @fsouza! I saw you marked it as closed but then reopened it. Did #1141 not fix the issue?
@fsouza commented on GitHub (May 3, 2023):
I'm not sure if the issue is fixed by that PR, looking at it I don't think I see how. It ended-up getting closed automatically due to a comment in the PR body. I still plan to have a deeper look at this issue some time in the next couple of weeks.
@otherguy commented on GitHub (May 4, 2023):
Awesome, thank you! Looking forward to the fix 😄
@larsivi commented on GitHub (Aug 18, 2024):
Thank you for this fantastic test tool!
I just ran into this issue, us using the node client libraries.
Creating a file with the "blob.createWriteStream" API, tests with explicit contentType failed as it always came back as "application/octet-stream", something that appears to be the default in upload.go if Content-Type header is missing.
I have verified that resumable is also the cause here, and if I put { resumable: false } into the createWriteStream-options, it works as it should. Setting this flag is probably ok as a workaround, especially as Google says it should be set to false for files smaller than 10MB, but presumably this means that it should be on for larger files.
I'm testing using 1.49.3
@mike-marcacci commented on GitHub (Sep 12, 2024):
Thanks for the workaround @larsivi. I can confirm that this fixed the issue in our case, also on 1.49.3.