[PR #1182] [MERGED] multipart uploads: Hack to support gsutil cp #1266

Closed
opened 2026-03-03 12:33:48 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/fsouza/fake-gcs-server/pull/1182
Author: @ekimekim
Created: 5/26/2023
Status: Merged
Merged: 5/27/2023
Merged by: @fsouza

Base: mainHead: gsutil-hack


📝 Commits (2)

  • 9134d76 multipart uploads: Hack to support gsutil cp
  • 7404445 Use ` to avoid having to escape

📊 Changes

1 file changed (+12 additions, -1 deletions)

View changed files

📝 fakestorage/upload.go (+12 -1)

📄 Description

gsutil sends an invalid multipart boundary param, which golang's mime.ParseMediaType correctly rejects.
However, the real GCS evidently does not reject this, so in order to make gsutil work we need to support it.

In particular, gsutil sends a boundary param that is quoted using single-quotes when it should be using double-quotes.
In cases where the param is definitely invalid (so we're guarenteed not to break any valid values), we replace all single-quotes with double-quotes to produce the intended meaning.

Upstream bug: https://github.com/GoogleCloudPlatform/gsutil/issues/1466

Fixes https://github.com/fsouza/fake-gcs-server/issues/217
The above issue found this bug and worked around it, but found another problem and never submitted the fix.
It seems that in the intervening time, the other problem was fixed independently, and I can successfully gsutil cp using this code.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/fsouza/fake-gcs-server/pull/1182 **Author:** [@ekimekim](https://github.com/ekimekim) **Created:** 5/26/2023 **Status:** ✅ Merged **Merged:** 5/27/2023 **Merged by:** [@fsouza](https://github.com/fsouza) **Base:** `main` ← **Head:** `gsutil-hack` --- ### 📝 Commits (2) - [`9134d76`](https://github.com/fsouza/fake-gcs-server/commit/9134d76248f33ca5921dba7664bdd9df2567da3f) multipart uploads: Hack to support gsutil cp - [`7404445`](https://github.com/fsouza/fake-gcs-server/commit/7404445c400cb36f066f0950006038ac7dd65acc) Use ` to avoid having to escape ### 📊 Changes **1 file changed** (+12 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `fakestorage/upload.go` (+12 -1) </details> ### 📄 Description `gsutil` sends an invalid multipart boundary param, which golang's `mime.ParseMediaType` correctly rejects. However, the real GCS evidently does not reject this, so in order to make `gsutil` work we need to support it. In particular, `gsutil` sends a boundary param that is quoted using single-quotes when it should be using double-quotes. In cases where the param is definitely invalid (so we're guarenteed not to break any valid values), we replace all single-quotes with double-quotes to produce the intended meaning. Upstream bug: https://github.com/GoogleCloudPlatform/gsutil/issues/1466 Fixes https://github.com/fsouza/fake-gcs-server/issues/217 The above issue found this bug and worked around it, but found another problem and never submitted the fix. It seems that in the intervening time, the other problem was fixed independently, and I can successfully `gsutil cp` using this code. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-03 12:33:48 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/fake-gcs-server#1266
No description provided.