mfarouk
mfarouk

Reputation: 654

Google Cloud Storage appends header/footer to a text file

I am using signed URLs to upload/download files to/from GCS.

Uploading files went fine, however when i try to download the file I can see a meta data header and footer are appended to the file, as in the attached screen shot. The same happens to image files, which makes the image non-viewable.

Is there a way to ensure the file added to GCS does not get modified in anyway ?

enter image description here

Upvotes: 1

Views: 144

Answers (1)

John Hanley
John Hanley

Reputation: 81366

The data appended to your upload is boundary markers. That means you are using the HTTP POST method with Content-Type: multipart/form-data.

Data is sent as a block of data ("body part"), with a user agent-defined delimiter ("boundary") separating each part. The keys are given in the Content-Disposition header of each part.

To upload data using a Signed URL, use the HTTP PUT method or switch to Signed Policy Documents.

Google Cloud Storage Policy Document

Upvotes: 3

Related Questions