10000 Copy operation ignores stored object settings if content-type is null · Issue #306 · googleapis/google-cloud-java · GitHub
[go: up one dir, main page]

Skip to content

Copy operation ignores stored object settings if content-type is null #306

@aozarov

Description

@aozarov

GCS Copy (and ReWrite) operations includes copying the original blob's metadata but also provides
a way to override the blob's metadata (such as content-type, contentLanguage, metadata fields).

When using the apiary copy or rewrite operations and supplying a StorageObject content it is going
to be used for blob's metadata overriding values. However, in this case content-type is required (and operation will fail if one is not provided).

Currently the implementation will silently ignore any overriding metadata if content-type is missing (as
in that case it will not pass the StorageObject content).

This is unexpected and not documented.

Several options:

  1. Just document this behaviour in the Storage.CopyRequest.Builder.target method.

  2. Change Storage.CopyRequest.Builder target settings to get either BlobId or BlobInfo (and in case of the latter also provide in the same setter BlobTargetOption... [and overload it with Iterable]. In this case we could either leave it with the javadoc suggestion (but only
    applies to the target that accepts BlobInfo) and maybe also throw IllegalArgumentException in such case.

  3. Based on [2] and instead of client side check we could change the RPC message to accept a flag to indicate if overriding the source metadata is desired.

  4. Probably also based on [2] and instead of client side check we could use the source metadata (by issuing a separate get request) and "patch" it manually.

Metadata

Metadata

Assignees

Labels

🚨This issue needs some love.api: storageIssues related to the Cloud Storage API.triage meI really want to be triaged.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0