Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/proud-terms-swim.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@tus/gcs-store": patch
---

Correctly pass the content type from upload.metadata to GCS.
7 changes: 5 additions & 2 deletions packages/gcs-store/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type {Bucket} from '@google-cloud/storage'
import type {Bucket, CreateWriteStreamOptions} from '@google-cloud/storage'
import stream from 'node:stream'
import type http from 'node:http'
import debug from 'debug'
Expand Down Expand Up @@ -35,14 +35,17 @@ export class GCSStore extends DataStore {

file.storage = {type: 'gcs', path: file.id, bucket: this.bucket.name}

const options = {
const options: CreateWriteStreamOptions = {
metadata: {
metadata: {
tus_version: TUS_RESUMABLE,
...this.#stringifyUploadKeys(file),
},
},
}
if (file.metadata?.contentType) {
options.contentType = file.metadata.contentType
}
const fake_stream = new stream.PassThrough()
fake_stream.end()
fake_stream
Expand Down
Loading