{"action":"created","comment":{"url":"https://api.github.com/repos/2gis/nuclear-vstore/pulls/comments/128196292","pull_request_review_id":50850798,"id":128196292,"diff_hunk":"@@ -84,45 +84,46 @@ public TemplatesStorageReader(CephOptions cephOptions, IAmazonS3 amazonS3)\n         {\n             var objectVersionId = string.IsNullOrEmpty(versionId) ? await GetTemplateLatestVersion(id) : versionId;\n \n-            GetObjectResponse response;\n             try\n             {\n-                response = await _amazonS3.GetObjectAsync(_bucketName, id.ToString(), objectVersionId);\n+                using (var response = await _amazonS3.GetObjectAsync(_bucketName, id.ToString(), objectVersionId))\n+                {\n+                    var metadataWrapper = MetadataCollectionWrapper.For(response.Metadata);\n+                    var author = metadataWrapper.Read<string>(MetadataElement.Author);\n+                    var authorLogin = metadataWrapper.Read<string>(MetadataElement.AuthorLogin);\n+                    var authorName = metadataWrapper.Read<string>(MetadataElement.AuthorName);\n+\n+                    string json;\n+                    using (var reader = new StreamReader(response.ResponseStream, Encoding.UTF8))\n+                    {\n+                        json = reader.ReadToEnd();\n+                    }\n+\n+                    var descriptor = new TemplateDescriptor\n+                        {\n+                            Id = id,\n+                            VersionId = objectVersionId,\n+                            LastModified = response.LastModified,\n+                            Author = author,\n+                            AuthorLogin = authorLogin,\n+                            AuthorName = authorName\n+                        };\n+                    JsonConvert.PopulateObject(json, descriptor, SerializerSettings.Default);\n+\n+                    return descriptor;\n+                }\n             }\n             catch (AmazonS3Exception ex) when (ex.StatusCode == HttpStatusCode.NotFound)\n             {\n                 throw new ObjectNotFoundException($\"Template '{id}' version '{objectVersionId}' not found\");\n             }\n-\n-            var metadataWrapper = MetadataCollectionWrapper.For(response.Metadata);\n-            var author = metadataWrapper.Read<string>(MetadataElement.Author);\n-            var authorLogin = metadataWrapper.Read<string>(MetadataElement.AuthorLogin);\n-            var authorName = metadataWrapper.Read<string>(MetadataElement.AuthorName);\n-\n-            string json;\n-            using (var reader = new StreamReader(response.ResponseStream, Encoding.UTF8))\n-            {\n-                json = reader.ReadToEnd();\n-            }\n-\n-            var descriptor = new TemplateDescriptor\n-                {\n-                    Id = id,\n-                    VersionId = objectVersionId,\n-                    LastModified = response.LastModified,\n-                    Author = author,\n-                    AuthorLogin = authorLogin,\n-                    AuthorName = authorName\n-                };\n-            JsonConvert.PopulateObject(json, descriptor, SerializerSettings.Default);\n-\n-            return descriptor;\n         }\n \n         public async Task<string> GetTemplateLatestVersion(long id)\n         {\n-            var versionsResponse = await _amazonS3.ListVersionsAsync(_bucketName, id.ToString());\n-            var version = versionsResponse.Versions.Find(x => !x.IsDeleteMarker && x.IsLatest);\n+            var strId = id.ToString();\n+            var versionsResponse = await _amazonS3.ListVersionsAsync(_bucketName, strId);\n+            var version = versionsResponse.Versions.Find(x => x.Key == strId && !x.IsDeleteMarker && x.IsLatest);","path":"src/VStore/Templates/TemplatesStorageReader.cs","position":85,"original_position":85,"commit_id":"0f4f5008f490e54874e4fbce5101d00b5eb09dc5","original_commit_id":"0f4f5008f490e54874e4fbce5101d00b5eb09dc5","user":{"login":"denisivan0v","id":5635171,"avatar_url":"https://avatars3.githubusercontent.com/u/5635171?v=4","gravatar_id":"","url":"https://api.github.com/users/denisivan0v","html_url":"https://github.com/denisivan0v","followers_url":"https://api.github.com/users/denisivan0v/followers","following_url":"https://api.github.com/users/denisivan0v/following{/other_user}","gists_url":"https://api.github.com/users/denisivan0v/gists{/gist_id}","starred_url":"https://api.github.com/users/denisivan0v/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/denisivan0v/subscriptions","organizations_url":"https://api.github.com/users/denisivan0v/orgs","repos_url":"https://api.github.com/users/denisivan0v/repos","events_url":"https://api.github.com/users/denisivan0v/events{/privacy}","received_events_url":"https://api.github.com/users/denisivan0v/received_events","type":"User","site_admin":false},"body":"Got it","created_at":"2017-07-19T09:24:08Z","updated_at":"2017-07-19T09:26:12Z","html_url":"https://github.com/2gis/nuclear-vstore/pull/75#discussion_r128196292","pull_request_url":"https://api.github.com/repos/2gis/nuclear-vstore/pulls/75","_links":{"self":{"href":"https://api.github.com/repos/2gis/nuclear-vstore/pulls/comments/128196292"},"html":{"href":"https://github.com/2gis/nuclear-vstore/pull/75#discussion_r128196292"},"pull_request":{"href":"https://api.github.com/repos/2gis/nuclear-vstore/pulls/75"}}},"pull_request":{"url":"https://api.github.com/repos/2gis/nuclear-vstore/pulls/75","id":131255443,"html_url":"https://github.com/2gis/nuclear-vstore/pull/75","diff_url":"https://github.com/2gis/nuclear-vstore/pull/75.diff","patch_url":"https://github.com/2gis/nuclear-vstore/pull/75.patch","issue_url":"https://api.github.com/repos/2gis/nuclear-vstore/issues/75","number":75,"state":"open","locked":false,"title":"[AMS-426] add Prometheus metrics","user":{"login":"xakep139","id":6381023,"avatar_url":"https://avatars2.githubusercontent.com/u/6381023?v=4","gravatar_id":"","url":"https://api.github.com/users/xakep139","html_url":"https://github.com/xakep139","followers_url":"https://api.github.com/users/xakep139/followers","following_url":"https://api.github.com/users/xakep139/following{/other_user}","gists_url":"https://api.github.com/users/xakep139/gists{/gist_id}","starred_url":"https://api.github.com/users/xakep139/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xakep139/subscriptions","organizations_url":"https://api.github.com/users/xakep139/orgs","repos_url":"https://api.github.com/users/xakep139/repos","events_url":"https://api.github.com/users/xakep139/events{/privacy}","received_events_url":"https://api.github.com/users/xakep139/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-07-19T07:37:51Z","updated_at":"2017-07-19T09:26:12Z","closed_at":null,"merged_at":null,"merge_commit_sha":"dbb116cbc7d8d694dc19612e7228dcd044f0c29f","assignee":{"login":"xakep139","id":6381023,"avatar_url":"https://avatars2.githubusercontent.com/u/6381023?v=4","gravatar_id":"","url":"https://api.github.com/users/xakep139","html_url":"https://github.com/xakep139","followers_url":"https://api.github.com/users/xakep139/followers","following_url":"https://api.github.com/users/xakep139/following{/other_user}","gists_url":"https://api.github.com/users/xakep139/gists{/gist_id}","starred_url":"https://api.github.com/users/xakep139/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xakep139/subscriptions","organizations_url":"https://api.github.com/users/xakep139/orgs","repos_url":"https://api.github.com/users/xakep139/repos","events_url":"https://api.github.com/users/xakep139/events{/privacy}","received_events_url":"https://api.github.com/users/xakep139/received_events","type":"User","site_admin":false},"assignees":[{"login":"xakep139","id":6381023,"avatar_url":"https://avatars2.githubusercontent.com/u/6381023?v=4","gravatar_id":"","url":"https://api.github.com/users/xakep139","html_url":"https://github.com/xakep139","followers_url":"https://api.github.com/users/xakep139/followers","following_url":"https://api.github.com/users/xakep139/following{/other_user}","gists_url":"https://api.github.com/users/xakep139/gists{/gist_id}","starred_url":"https://api.github.com/users/xakep139/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xakep139/subscriptions","organizations_url":"https://api.github.com/users/xakep139/orgs","repos_url":"https://api.github.com/users/xakep139/repos","events_url":"https://api.github.com/users/xakep139/events{/privacy}","received_events_url":"https://api.github.com/users/xakep139/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"milestone":{"url":"https://api.github.com/repos/2gis/nuclear-vstore/milestones/8","html_url":"https://github.com/2gis/nuclear-vstore/milestone/8","labels_url":"https://api.github.com/repos/2gis/nuclear-vstore/milestones/8/labels","id":2633808,"number":8,"title":"0.14.x","description":"","creator":{"login":"xakep139","id":6381023,"avatar_url":"https://avatars2.githubusercontent.com/u/6381023?v=4","gravatar_id":"","url":"https://api.github.com/users/xakep139","html_url":"https://github.com/xakep139","followers_url":"https://api.github.com/users/xakep139/followers","following_url":"https://api.github.com/users/xakep139/following{/other_user}","gists_url":"https://api.github.com/users/xakep139/gists{/gist_id}","starred_url":"https://api.github.com/users/xakep139/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xakep139/subscriptions","organizations_url":"https://api.github.com/users/xakep139/orgs","repos_url":"https://api.github.com/users/xakep139/repos","events_url":"https://api.github.com/users/xakep139/events{/privacy}","received_events_url":"https://api.github.com/users/xakep139/received_events","type":"User","site_admin":false},"open_issues":2,"closed_issues":0,"state":"open","created_at":"2017-07-11T08:22:16Z","updated_at":"2017-07-19T07:37:51Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/2gis/nuclear-vstore/pulls/75/commits","review_comments_url":"https://api.github.com/repos/2gis/nuclear-vstore/pulls/75/comments","review_comment_url":"https://api.github.com/repos/2gis/nuclear-vstore/pulls/comments{/number}","comments_url":"https://api.github.com/repos/2gis/nuclear-vstore/issues/75/comments","statuses_url":"https://api.github.com/repos/2gis/nuclear-vstore/statuses/0f4f5008f490e54874e4fbce5101d00b5eb09dc5","head":{"label":"2gis:feature/AMS-426","ref":"feature/AMS-426","sha":"0f4f5008f490e54874e4fbce5101d00b5eb09dc5","user":{"login":"2gis","id":1481435,"avatar_url":"https://avatars2.githubusercontent.com/u/1481435?v=4","gravatar_id":"","url":"https://api.github.com/users/2gis","html_url":"https://github.com/2gis","followers_url":"https://api.github.com/users/2gis/followers","following_url":"https://api.github.com/users/2gis/following{/other_user}","gists_url":"https://api.github.com/users/2gis/gists{/gist_id}","starred_url":"https://api.github.com/users/2gis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/2gis/subscriptions","organizations_url":"https://api.github.com/users/2gis/orgs","repos_url":"https://api.github.com/users/2gis/repos","events_url":"https://api.github.com/users/2gis/events{/privacy}","received_events_url":"https://api.github.com/users/2gis/received_events","type":"Organization","site_admin":false},"repo":{"id":68580069,"name":"nuclear-vstore","full_name":"2gis/nuclear-vstore","owner":{"login":"2gis","id":1481435,"avatar_url":"https://avatars2.githubusercontent.com/u/1481435?v=4","gravatar_id":"","url":"https://api.github.com/users/2gis","html_url":"https://github.com/2gis","followers_url":"https://api.github.com/users/2gis/followers","following_url":"https://api.github.com/users/2gis/following{/other_user}","gists_url":"https://api.github.com/users/2gis/gists{/gist_id}","starred_url":"https://api.github.com/users/2gis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/2gis/subscriptions","organizations_url":"https://api.github.com/users/2gis/orgs","repos_url":"https://api.github.com/users/2gis/repos","events_url":"https://api.github.com/users/2gis/events{/privacy}","received_events_url":"https://api.github.com/users/2gis/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/2gis/nuclear-vstore","description":"NuClear VStore - advertising data storage with versioning","fork":false,"url":"https://api.github.com/repos/2gis/nuclear-vstore","forks_url":"https://api.github.com/repos/2gis/nuclear-vstore/forks","keys_url":"https://api.github.com/repos/2gis/nuclear-vstore/keys{/key_id}","collaborators_url":"https://api.github.com/repos/2gis/nuclear-vstore/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/2gis/nuclear-vstore/teams","hooks_url":"https://api.github.com/repos/2gis/nuclear-vstore/hooks","issue_events_url":"https://api.github.com/repos/2gis/nuclear-vstore/issues/events{/number}","events_url":"https://api.github.com/repos/2gis/nuclear-vstore/events","assignees_url":"https://api.github.com/repos/2gis/nuclear-vstore/assignees{/user}","branches_url":"https://api.github.com/repos/2gis/nuclear-vstore/branches{/branch}","tags_url":"https://api.github.com/repos/2gis/nuclear-vstore/tags","blobs_url":"https://api.github.com/repos/2gis/nuclear-vstore/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/2gis/nuclear-vstore/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/2gis/nuclear-vstore/git/refs{/sha}","trees_url":"https://api.github.com/repos/2gis/nuclear-vstore/git/trees{/sha}","statuses_url":"https://api.github.com/repos/2gis/nuclear-vstore/statuses/{sha}","languages_url":"https://api.github.com/repos/2gis/nuclear-vstore/languages","stargazers_url":"https://api.github.com/repos/2gis/nuclear-vstore/stargazers","contributors_url":"https://api.github.com/repos/2gis/nuclear-vstore/contributors","subscribers_url":"https://api.github.com/repos/2gis/nuclear-vstore/subscribers","subscription_url":"https://api.github.com/repos/2gis/nuclear-vstore/subscription","commits_url":"https://api.github.com/repos/2gis/nuclear-vstore/commits{/sha}","git_commits_url":"https://api.github.com/repos/2gis/nuclear-vstore/git/commits{/sha}","comments_url":"https://api.github.com/repos/2gis/nuclear-vstore/comments{/number}","issue_comment_url":"https://api.github.com/repos/2gis/nuclear-vstore/issues/comments{/number}","contents_url":"https://api.github.com/repos/2gis/nuclear-vstore/contents/{+path}","compare_url":"https://api.github.com/repos/2gis/nuclear-vstore/compare/{base}...{head}","merges_url":"https://api.github.com/repos/2gis/nuclear-vstore/merges","archive_url":"https://api.github.com/repos/2gis/nuclear-vstore/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/2gis/nuclear-vstore/downloads","issues_url":"https://api.github.com/repos/2gis/nuclear-vstore/issues{/number}","pulls_url":"https://api.github.com/repos/2gis/nuclear-vstore/pulls{/number}","milestones_url":"https://api.github.com/repos/2gis/nuclear-vstore/milestones{/number}","notifications_url":"https://api.github.com/repos/2gis/nuclear-vstore/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/2gis/nuclear-vstore/labels{/name}","releases_url":"https://api.github.com/repos/2gis/nuclear-vstore/releases{/id}","deployments_url":"https://api.github.com/repos/2gis/nuclear-vstore/deployments","created_at":"2016-09-19T07:25:16Z","updated_at":"2017-07-13T09:31:51Z","pushed_at":"2017-07-19T09:21:02Z","git_url":"git://github.com/2gis/nuclear-vstore.git","ssh_url":"git@github.com:2gis/nuclear-vstore.git","clone_url":"https://github.com/2gis/nuclear-vstore.git","svn_url":"https://github.com/2gis/nuclear-vstore","homepage":"","size":3245,"stargazers_count":2,"watchers_count":2,"language":"C#","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":7,"forks":0,"open_issues":7,"watchers":2,"default_branch":"master"}},"base":{"label":"2gis:master","ref":"master","sha":"d6e7fbf8e4e5a29a86f270ae527cca7242439e7d","user":{"login":"2gis","id":1481435,"avatar_url":"https://avatars2.githubusercontent.com/u/1481435?v=4","gravatar_id":"","url":"https://api.github.com/users/2gis","html_url":"https://github.com/2gis","followers_url":"https://api.github.com/users/2gis/followers","following_url":"https://api.github.com/users/2gis/following{/other_user}","gists_url":"https://api.github.com/users/2gis/gists{/gist_id}","starred_url":"https://api.github.com/users/2gis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/2gis/subscriptions","organizations_url":"https://api.github.com/users/2gis/orgs","repos_url":"https://api.github.com/users/2gis/repos","events_url":"https://api.github.com/users/2gis/events{/privacy}","received_events_url":"https://api.github.com/users/2gis/received_events","type":"Organization","site_admin":false},"repo":{"id":68580069,"name":"nuclear-vstore","full_name":"2gis/nuclear-vstore","owner":{"login":"2gis","id":1481435,"avatar_url":"https://avatars2.githubusercontent.com/u/1481435?v=4","gravatar_id":"","url":"https://api.github.com/users/2gis","html_url":"https://github.com/2gis","followers_url":"https://api.github.com/users/2gis/followers","following_url":"https://api.github.com/users/2gis/following{/other_user}","gists_url":"https://api.github.com/users/2gis/gists{/gist_id}","starred_url":"https://api.github.com/users/2gis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/2gis/subscriptions","organizations_url":"https://api.github.com/users/2gis/orgs","repos_url":"https://api.github.com/users/2gis/repos","events_url":"https://api.github.com/users/2gis/events{/privacy}","received_events_url":"https://api.github.com/users/2gis/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/2gis/nuclear-vstore","description":"NuClear VStore - advertising data storage with versioning","fork":false,"url":"https://api.github.com/repos/2gis/nuclear-vstore","forks_url":"https://api.github.com/repos/2gis/nuclear-vstore/forks","keys_url":"https://api.github.com/repos/2gis/nuclear-vstore/keys{/key_id}","collaborators_url":"https://api.github.com/repos/2gis/nuclear-vstore/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/2gis/nuclear-vstore/teams","hooks_url":"https://api.github.com/repos/2gis/nuclear-vstore/hooks","issue_events_url":"https://api.github.com/repos/2gis/nuclear-vstore/issues/events{/number}","events_url":"https://api.github.com/repos/2gis/nuclear-vstore/events","assignees_url":"https://api.github.com/repos/2gis/nuclear-vstore/assignees{/user}","branches_url":"https://api.github.com/repos/2gis/nuclear-vstore/branches{/branch}","tags_url":"https://api.github.com/repos/2gis/nuclear-vstore/tags","blobs_url":"https://api.github.com/repos/2gis/nuclear-vstore/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/2gis/nuclear-vstore/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/2gis/nuclear-vstore/git/refs{/sha}","trees_url":"https://api.github.com/repos/2gis/nuclear-vstore/git/trees{/sha}","statuses_url":"https://api.github.com/repos/2gis/nuclear-vstore/statuses/{sha}","languages_url":"https://api.github.com/repos/2gis/nuclear-vstore/languages","stargazers_url":"https://api.github.com/repos/2gis/nuclear-vstore/stargazers","contributors_url":"https://api.github.com/repos/2gis/nuclear-vstore/contributors","subscribers_url":"https://api.github.com/repos/2gis/nuclear-vstore/subscribers","subscription_url":"https://api.github.com/repos/2gis/nuclear-vstore/subscription","commits_url":"https://api.github.com/repos/2gis/nuclear-vstore/commits{/sha}","git_commits_url":"https://api.github.com/repos/2gis/nuclear-vstore/git/commits{/sha}","comments_url":"https://api.github.com/repos/2gis/nuclear-vstore/comments{/number}","issue_comment_url":"https://api.github.com/repos/2gis/nuclear-vstore/issues/comments{/number}","contents_url":"https://api.github.com/repos/2gis/nuclear-vstore/contents/{+path}","compare_url":"https://api.github.com/repos/2gis/nuclear-vstore/compare/{base}...{head}","merges_url":"https://api.github.com/repos/2gis/nuclear-vstore/merges","archive_url":"https://api.github.com/repos/2gis/nuclear-vstore/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/2gis/nuclear-vstore/downloads","issues_url":"https://api.github.com/repos/2gis/nuclear-vstore/issues{/number}","pulls_url":"https://api.github.com/repos/2gis/nuclear-vstore/pulls{/number}","milestones_url":"https://api.github.com/repos/2gis/nuclear-vstore/milestones{/number}","notifications_url":"https://api.github.com/repos/2gis/nuclear-vstore/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/2gis/nuclear-vstore/labels{/name}","releases_url":"https://api.github.com/repos/2gis/nuclear-vstore/releases{/id}","deployments_url":"https://api.github.com/repos/2gis/nuclear-vstore/deployments","created_at":"2016-09-19T07:25:16Z","updated_at":"2017-07-13T09:31:51Z","pushed_at":"2017-07-19T09:21:02Z","git_url":"git://github.com/2gis/nuclear-vstore.git","ssh_url":"git@github.com:2gis/nuclear-vstore.git","clone_url":"https://github.com/2gis/nuclear-vstore.git","svn_url":"https://github.com/2gis/nuclear-vstore","homepage":"","size":3245,"stargazers_count":2,"watchers_count":2,"language":"C#","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":7,"forks":0,"open_issues":7,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/2gis/nuclear-vstore/pulls/75"},"html":{"href":"https://github.com/2gis/nuclear-vstore/pull/75"},"issue":{"href":"https://api.github.com/repos/2gis/nuclear-vstore/issues/75"},"comments":{"href":"https://api.github.com/repos/2gis/nuclear-vstore/issues/75/comments"},"review_comments":{"href":"https://api.github.com/repos/2gis/nuclear-vstore/pulls/75/comments"},"review_comment":{"href":"https://api.github.com/repos/2gis/nuclear-vstore/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/2gis/nuclear-vstore/pulls/75/commits"},"statuses":{"href":"https://api.github.com/repos/2gis/nuclear-vstore/statuses/0f4f5008f490e54874e4fbce5101d00b5eb09dc5"}}}}
{"actor":{"display_login":"denisivan0v"}}