Skip to content

Commit

Permalink
fix(GCS+gRPC): correct format Object ids (#7559)
Browse files Browse the repository at this point in the history
  • Loading branch information
coryan authored Nov 4, 2021
1 parent 2585fb5 commit 6f47d5b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion google/cloud/storage/internal/grpc_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,7 @@ ObjectMetadata GrpcClient::FromProto(google::storage::v2::Object object) {
metadata.bucket_ = bucket_id(object);
metadata.name_ = std::move(*object.mutable_name());
metadata.generation_ = object.generation();
metadata.id_ = metadata.bucket() + "/" + metadata.name() + "#" +
metadata.id_ = metadata.bucket() + "/" + metadata.name() + "/" +
std::to_string(metadata.generation());
metadata.metageneration_ = object.metageneration();
if (object.has_owner()) {
Expand Down
2 changes: 1 addition & 1 deletion google/cloud/storage/internal/grpc_client_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ TEST(GrpcClientFromProto, ObjectSimple) {
},
"eventBasedHold": true,
"name": "test-object-name",
"id": "test-bucket/test-object-name#2345",
"id": "test-bucket/test-object-name/2345",
"kind": "storage#object",
"bucket": "test-bucket",
"generation": 2345,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ TEST_F(ObjectBasicCRUDIntegrationTest, BasicCRUD) {
Projection("full"));
ASSERT_STATUS_OK(get_meta);

// TODO(#7257) - cleanup after production is fixed.
if (UsingGrpc()) {
// The metadata returned by gRPC (InsertObject) doesn't contain the `acl`,
// `etag`, `media_link`, or `self_link` fields. Just compare field by field:
Expand All @@ -89,7 +88,7 @@ TEST_F(ObjectBasicCRUDIntegrationTest, BasicCRUD) {
EXPECT_EQ(get_meta->crc32c(), insert_meta->crc32c());
EXPECT_EQ(get_meta->event_based_hold(), insert_meta->event_based_hold());
EXPECT_EQ(get_meta->generation(), insert_meta->generation());
// EXPECT_EQ(get_meta->id(), insert_meta->id()); // b/198515640
EXPECT_EQ(get_meta->id(), insert_meta->id());
EXPECT_EQ(get_meta->kind(), insert_meta->kind());
EXPECT_EQ(get_meta->kms_key_name(), insert_meta->kms_key_name());
EXPECT_EQ(get_meta->md5_hash(), insert_meta->md5_hash());
Expand Down

0 comments on commit 6f47d5b

Please sign in to comment.