{"action":"opened","issue":{"url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/issues/306","labels_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/issues/306/labels{/name}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/issues/306/comments","events_url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/issues/306/events","html_url":"https://github.com/GoogleCloudPlatform/gcloud-java/issues/306","id":113961075,"number":306,"title":"Copy operation ignores stored object settings if content-type is null","user":{"login":"aozarov","id":8921691,"avatar_url":"https://avatars.githubusercontent.com/u/8921691?v=3","gravatar_id":"","url":"https://api.github.com/users/aozarov","html_url":"https://github.com/aozarov","followers_url":"https://api.github.com/users/aozarov/followers","following_url":"https://api.github.com/users/aozarov/following{/other_user}","gists_url":"https://api.github.com/users/aozarov/gists{/gist_id}","starred_url":"https://api.github.com/users/aozarov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aozarov/subscriptions","organizations_url":"https://api.github.com/users/aozarov/orgs","repos_url":"https://api.github.com/users/aozarov/repos","events_url":"https://api.github.com/users/aozarov/events{/privacy}","received_events_url":"https://api.github.com/users/aozarov/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/GoogleCloudPlatform/gcloud-java/labels/storage","name":"storage","color":"f7c6c7"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-10-29T01:43:38Z","updated_at":"2015-10-29T01:43:38Z","closed_at":null,"body":"GCS Copy (and ReWrite) operations includes copying the original blob's metadata but also provides \r\na way to override the blob's metadata (such as content-type, contentLanguage, metadata fields).\r\n\r\nWhen using the apiary copy or rewrite operations and supplying a `StorageObject` content it is going\r\nto 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).\r\n\r\nCurrently the implementation will silently ignore any overriding metadata if content-type is missing (as\r\nin that case it will not pass the `StorageObject` content).\r\n\r\nThis is unexpected and not documented.\r\n\r\nSeveral options:\r\n\r\n1) Just document this behaviour in the `Storage.CopyRequest.Builder.target` method.\r\n\r\n2) 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<BlobTargetOption>]. In this case we could either leave it with the javadoc suggestion (but only\r\napplies to the target that accepts `BlobInfo`) and maybe also throw `IllegalArgumentException` in such case.\r\n\r\n3) 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.\r\n\r\n4) 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."}}