Skip to content

Commit 6e81e05

Browse files
feat: allow setting contentEncoding during compose (#2431)
* feat: allow setting contentEncoding during compose * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 261d119 commit 6e81e05

File tree

5 files changed

+10
-12
lines changed

5 files changed

+10
-12
lines changed

src/bucket.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1658,6 +1658,7 @@ class Bucket extends ServiceObject<Bucket, BucketMetadata> {
16581658
json: {
16591659
destination: {
16601660
contentType: destinationFile.metadata.contentType,
1661+
contentEncoding: destinationFile.metadata.contentEncoding,
16611662
},
16621663
sourceObjects: (sources as File[]).map(source => {
16631664
const sourceObject = {

src/nodejs-common/service.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -271,9 +271,8 @@ export class Service {
271271
};
272272

273273
if (reqOpts[GCCL_GCS_CMD_KEY]) {
274-
reqOpts.headers[
275-
'x-goog-api-client'
276-
] += ` gccl-gcs-cmd/${reqOpts[GCCL_GCS_CMD_KEY]}`;
274+
reqOpts.headers['x-goog-api-client'] +=
275+
` gccl-gcs-cmd/${reqOpts[GCCL_GCS_CMD_KEY]}`;
277276
}
278277

279278
if (reqOpts.shouldReturnStream) {

src/resumable-upload.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -933,9 +933,8 @@ export class Upload extends Writable {
933933
// `Content-Length` for multiple chunk uploads is the size of the chunk,
934934
// not the overall object
935935
headers['Content-Length'] = bytesToUpload;
936-
headers[
937-
'Content-Range'
938-
] = `bytes ${this.offset}-${endingByte}/${totalObjectSize}`;
936+
headers['Content-Range'] =
937+
`bytes ${this.offset}-${endingByte}/${totalObjectSize}`;
939938
} else {
940939
headers['Content-Range'] = `bytes ${this.offset}-*/${this.contentLength}`;
941940
}

src/transfer-manager.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,8 @@ class XMLMultiPartUploadHelper implements MultiPartUploadHelper {
223223

224224
// Prepend command feature to value, if not already there
225225
if (!value.includes(GCCL_GCS_CMD_FEATURE.UPLOAD_SHARDED)) {
226-
headers[
227-
key
228-
] = `${value} gccl-gcs-cmd/${GCCL_GCS_CMD_FEATURE.UPLOAD_SHARDED}`;
226+
headers[key] =
227+
`${value} gccl-gcs-cmd/${GCCL_GCS_CMD_FEATURE.UPLOAD_SHARDED}`;
229228
}
230229
} else if (key.toLocaleLowerCase().trim() === 'user-agent') {
231230
userAgentFound = true;

test/bucket.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -745,13 +745,13 @@ describe('Bucket', () => {
745745
});
746746

747747
it('should make correct API request', done => {
748-
const sources = [bucket.file('1.txt'), bucket.file('2.txt')];
749-
const destination = bucket.file('destination.txt');
748+
const sources = [bucket.file('1.foo'), bucket.file('2.foo')];
749+
const destination = bucket.file('destination.foo');
750750

751751
destination.request = (reqOpts: DecorateRequestOptions) => {
752752
assert.strictEqual(reqOpts.uri, '/compose');
753753
assert.deepStrictEqual(reqOpts.json, {
754-
destination: {contentType: mime.contentType(destination.name)},
754+
destination: {contentType: undefined, contentEncoding: undefined},
755755
sourceObjects: [{name: sources[0].name}, {name: sources[1].name}],
756756
});
757757

0 commit comments

Comments
 (0)