{"action":"created","comment":{"url":"https://api.github.com/repos/minio/minio-hs/pulls/comments/175545290","pull_request_review_id":105091737,"id":175545290,"diff_hunk":"@@ -208,15 +210,18 @@ mkHeaderFromMetadata :: [(Text, Text)] -> [HT.Header]\n mkHeaderFromMetadata = map (\\(x, y) -> (mk $ encodeUtf8 $ addXAmzMetaPrefix $ T.toLower x, encodeUtf8 y))\n \n pooToHeaders :: PutObjectOptions -> [HT.Header]\n-pooToHeaders poo = userMetadata ++ zip names values\n+pooToHeaders poo = userMetadata\n+                   ++ map (\\(k, v) ->\n+                             (k, fromJust v))\n+                   (filter (\\(_, v) -> isJust v) (zipWith (,) names values))\n   where\n     userMetadata = mkHeaderFromMetadata $ pooUserMetadata poo\n \n     names = [\"content-type\",\n              \"content-encoding\",\n              \"content-disposition\",\n              \"cache-control\"]\n-    values = mapMaybe (fmap encodeUtf8 . (poo &))\n+    values = map (fmap encodeUtf8 . (poo &))","path":"src/Network/Minio/Data.hs","position":55,"original_position":54,"commit_id":"72c42cbdbd7e3e0f65de7426caec62dba2429559","original_commit_id":"1dd80566d110e09fe6fef3a7512a1f98f5a2903d","user":{"login":"donatello","id":200059,"avatar_url":"https://avatars0.githubusercontent.com/u/200059?v=4","gravatar_id":"","url":"https://api.github.com/users/donatello","html_url":"https://github.com/donatello","followers_url":"https://api.github.com/users/donatello/followers","following_url":"https://api.github.com/users/donatello/following{/other_user}","gists_url":"https://api.github.com/users/donatello/gists{/gist_id}","starred_url":"https://api.github.com/users/donatello/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/donatello/subscriptions","organizations_url":"https://api.github.com/users/donatello/orgs","repos_url":"https://api.github.com/users/donatello/repos","events_url":"https://api.github.com/users/donatello/events{/privacy}","received_events_url":"https://api.github.com/users/donatello/received_events","type":"User","site_admin":false},"body":"The problem here is we are apply a function on a list of Maybe's with `mapMaybe`. `mapMaybe` removes elements in the list which are `Nothing`:\r\n\r\n```\r\nPrelude> import Data.Maybe\r\nPrelude Data.Maybe> mapMaybe (fmap (+2)) [Nothing, Just 3]\r\n[5]\r\nPrelude Data.Maybe> :t mapMaybe\r\nmapMaybe :: (a -> Maybe b) -> [a] -> [b]\r\n```\r\n\r\nSo in the above code, when we `zipWith` the `names` list we end up putting matching up the wrong header names with header values. @krisis' fix is to only use `map` and not filter the elements which are `Nothing` and handling the Maybe's after zipping.","created_at":"2018-03-19T18:44:15Z","updated_at":"2018-03-19T18:44:15Z","html_url":"https://github.com/minio/minio-hs/pull/81#discussion_r175545290","pull_request_url":"https://api.github.com/repos/minio/minio-hs/pulls/81","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/minio/minio-hs/pulls/comments/175545290"},"html":{"href":"https://github.com/minio/minio-hs/pull/81#discussion_r175545290"},"pull_request":{"href":"https://api.github.com/repos/minio/minio-hs/pulls/81"}},"in_reply_to_id":175499739},"pull_request":{"url":"https://api.github.com/repos/minio/minio-hs/pulls/81","id":175900112,"html_url":"https://github.com/minio/minio-hs/pull/81","diff_url":"https://github.com/minio/minio-hs/pull/81.diff","patch_url":"https://github.com/minio/minio-hs/pull/81.patch","issue_url":"https://api.github.com/repos/minio/minio-hs/issues/81","number":81,"state":"open","locked":false,"title":"Fix pooToHeaders to associate right header names to values","user":{"login":"krisis","id":522593,"avatar_url":"https://avatars3.githubusercontent.com/u/522593?v=4","gravatar_id":"","url":"https://api.github.com/users/krisis","html_url":"https://github.com/krisis","followers_url":"https://api.github.com/users/krisis/followers","following_url":"https://api.github.com/users/krisis/following{/other_user}","gists_url":"https://api.github.com/users/krisis/gists{/gist_id}","starred_url":"https://api.github.com/users/krisis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/krisis/subscriptions","organizations_url":"https://api.github.com/users/krisis/orgs","repos_url":"https://api.github.com/users/krisis/repos","events_url":"https://api.github.com/users/krisis/events{/privacy}","received_events_url":"https://api.github.com/users/krisis/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-03-19T13:32:53Z","updated_at":"2018-03-19T18:44:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f09298931ec3532f0eeb1e728564c106c63580e0","assignee":null,"assignees":[],"requested_reviewers":[{"login":"harshavardhana","id":622699,"avatar_url":"https://avatars0.githubusercontent.com/u/622699?v=4","gravatar_id":"","url":"https://api.github.com/users/harshavardhana","html_url":"https://github.com/harshavardhana","followers_url":"https://api.github.com/users/harshavardhana/followers","following_url":"https://api.github.com/users/harshavardhana/following{/other_user}","gists_url":"https://api.github.com/users/harshavardhana/gists{/gist_id}","starred_url":"https://api.github.com/users/harshavardhana/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/harshavardhana/subscriptions","organizations_url":"https://api.github.com/users/harshavardhana/orgs","repos_url":"https://api.github.com/users/harshavardhana/repos","events_url":"https://api.github.com/users/harshavardhana/events{/privacy}","received_events_url":"https://api.github.com/users/harshavardhana/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/minio/minio-hs/pulls/81/commits","review_comments_url":"https://api.github.com/repos/minio/minio-hs/pulls/81/comments","review_comment_url":"https://api.github.com/repos/minio/minio-hs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/minio/minio-hs/issues/81/comments","statuses_url":"https://api.github.com/repos/minio/minio-hs/statuses/72c42cbdbd7e3e0f65de7426caec62dba2429559","head":{"label":"krisis:fix/pooToHeaders","ref":"fix/pooToHeaders","sha":"72c42cbdbd7e3e0f65de7426caec62dba2429559","user":{"login":"krisis","id":522593,"avatar_url":"https://avatars3.githubusercontent.com/u/522593?v=4","gravatar_id":"","url":"https://api.github.com/users/krisis","html_url":"https://github.com/krisis","followers_url":"https://api.github.com/users/krisis/followers","following_url":"https://api.github.com/users/krisis/following{/other_user}","gists_url":"https://api.github.com/users/krisis/gists{/gist_id}","starred_url":"https://api.github.com/users/krisis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/krisis/subscriptions","organizations_url":"https://api.github.com/users/krisis/orgs","repos_url":"https://api.github.com/users/krisis/repos","events_url":"https://api.github.com/users/krisis/events{/privacy}","received_events_url":"https://api.github.com/users/krisis/received_events","type":"User","site_admin":false},"repo":{"id":81901888,"name":"minio-hs","full_name":"krisis/minio-hs","owner":{"login":"krisis","id":522593,"avatar_url":"https://avatars3.githubusercontent.com/u/522593?v=4","gravatar_id":"","url":"https://api.github.com/users/krisis","html_url":"https://github.com/krisis","followers_url":"https://api.github.com/users/krisis/followers","following_url":"https://api.github.com/users/krisis/following{/other_user}","gists_url":"https://api.github.com/users/krisis/gists{/gist_id}","starred_url":"https://api.github.com/users/krisis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/krisis/subscriptions","organizations_url":"https://api.github.com/users/krisis/orgs","repos_url":"https://api.github.com/users/krisis/repos","events_url":"https://api.github.com/users/krisis/events{/privacy}","received_events_url":"https://api.github.com/users/krisis/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/krisis/minio-hs","description":"Minio Client SDK for Haskell","fork":true,"url":"https://api.github.com/repos/krisis/minio-hs","forks_url":"https://api.github.com/repos/krisis/minio-hs/forks","keys_url":"https://api.github.com/repos/krisis/minio-hs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/krisis/minio-hs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/krisis/minio-hs/teams","hooks_url":"https://api.github.com/repos/krisis/minio-hs/hooks","issue_events_url":"https://api.github.com/repos/krisis/minio-hs/issues/events{/number}","events_url":"https://api.github.com/repos/krisis/minio-hs/events","assignees_url":"https://api.github.com/repos/krisis/minio-hs/assignees{/user}","branches_url":"https://api.github.com/repos/krisis/minio-hs/branches{/branch}","tags_url":"https://api.github.com/repos/krisis/minio-hs/tags","blobs_url":"https://api.github.com/repos/krisis/minio-hs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/krisis/minio-hs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/krisis/minio-hs/git/refs{/sha}","trees_url":"https://api.github.com/repos/krisis/minio-hs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/krisis/minio-hs/statuses/{sha}","languages_url":"https://api.github.com/repos/krisis/minio-hs/languages","stargazers_url":"https://api.github.com/repos/krisis/minio-hs/stargazers","contributors_url":"https://api.github.com/repos/krisis/minio-hs/contributors","subscribers_url":"https://api.github.com/repos/krisis/minio-hs/subscribers","subscription_url":"https://api.github.com/repos/krisis/minio-hs/subscription","commits_url":"https://api.github.com/repos/krisis/minio-hs/commits{/sha}","git_commits_url":"https://api.github.com/repos/krisis/minio-hs/git/commits{/sha}","comments_url":"https://api.github.com/repos/krisis/minio-hs/comments{/number}","issue_comment_url":"https://api.github.com/repos/krisis/minio-hs/issues/comments{/number}","contents_url":"https://api.github.com/repos/krisis/minio-hs/contents/{+path}","compare_url":"https://api.github.com/repos/krisis/minio-hs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/krisis/minio-hs/merges","archive_url":"https://api.github.com/repos/krisis/minio-hs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/krisis/minio-hs/downloads","issues_url":"https://api.github.com/repos/krisis/minio-hs/issues{/number}","pulls_url":"https://api.github.com/repos/krisis/minio-hs/pulls{/number}","milestones_url":"https://api.github.com/repos/krisis/minio-hs/milestones{/number}","notifications_url":"https://api.github.com/repos/krisis/minio-hs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/krisis/minio-hs/labels{/name}","releases_url":"https://api.github.com/repos/krisis/minio-hs/releases{/id}","deployments_url":"https://api.github.com/repos/krisis/minio-hs/deployments","created_at":"2017-02-14T03:44:28Z","updated_at":"2017-02-14T03:50:41Z","pushed_at":"2018-03-19T17:17:35Z","git_url":"git://github.com/krisis/minio-hs.git","ssh_url":"git@github.com:krisis/minio-hs.git","clone_url":"https://github.com/krisis/minio-hs.git","svn_url":"https://github.com/krisis/minio-hs","homepage":null,"size":296,"stargazers_count":0,"watchers_count":0,"language":"Haskell","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"minio:master","ref":"master","sha":"37940ad170a8a0562e4e0e398d918a281c6bebf3","user":{"login":"minio","id":695951,"avatar_url":"https://avatars3.githubusercontent.com/u/695951?v=4","gravatar_id":"","url":"https://api.github.com/users/minio","html_url":"https://github.com/minio","followers_url":"https://api.github.com/users/minio/followers","following_url":"https://api.github.com/users/minio/following{/other_user}","gists_url":"https://api.github.com/users/minio/gists{/gist_id}","starred_url":"https://api.github.com/users/minio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/minio/subscriptions","organizations_url":"https://api.github.com/users/minio/orgs","repos_url":"https://api.github.com/users/minio/repos","events_url":"https://api.github.com/users/minio/events{/privacy}","received_events_url":"https://api.github.com/users/minio/received_events","type":"Organization","site_admin":false},"repo":{"id":81812144,"name":"minio-hs","full_name":"minio/minio-hs","owner":{"login":"minio","id":695951,"avatar_url":"https://avatars3.githubusercontent.com/u/695951?v=4","gravatar_id":"","url":"https://api.github.com/users/minio","html_url":"https://github.com/minio","followers_url":"https://api.github.com/users/minio/followers","following_url":"https://api.github.com/users/minio/following{/other_user}","gists_url":"https://api.github.com/users/minio/gists{/gist_id}","starred_url":"https://api.github.com/users/minio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/minio/subscriptions","organizations_url":"https://api.github.com/users/minio/orgs","repos_url":"https://api.github.com/users/minio/repos","events_url":"https://api.github.com/users/minio/events{/privacy}","received_events_url":"https://api.github.com/users/minio/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/minio/minio-hs","description":"Minio Client SDK for Haskell","fork":false,"url":"https://api.github.com/repos/minio/minio-hs","forks_url":"https://api.github.com/repos/minio/minio-hs/forks","keys_url":"https://api.github.com/repos/minio/minio-hs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/minio/minio-hs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/minio/minio-hs/teams","hooks_url":"https://api.github.com/repos/minio/minio-hs/hooks","issue_events_url":"https://api.github.com/repos/minio/minio-hs/issues/events{/number}","events_url":"https://api.github.com/repos/minio/minio-hs/events","assignees_url":"https://api.github.com/repos/minio/minio-hs/assignees{/user}","branches_url":"https://api.github.com/repos/minio/minio-hs/branches{/branch}","tags_url":"https://api.github.com/repos/minio/minio-hs/tags","blobs_url":"https://api.github.com/repos/minio/minio-hs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/minio/minio-hs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/minio/minio-hs/git/refs{/sha}","trees_url":"https://api.github.com/repos/minio/minio-hs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/minio/minio-hs/statuses/{sha}","languages_url":"https://api.github.com/repos/minio/minio-hs/languages","stargazers_url":"https://api.github.com/repos/minio/minio-hs/stargazers","contributors_url":"https://api.github.com/repos/minio/minio-hs/contributors","subscribers_url":"https://api.github.com/repos/minio/minio-hs/subscribers","subscription_url":"https://api.github.com/repos/minio/minio-hs/subscription","commits_url":"https://api.github.com/repos/minio/minio-hs/commits{/sha}","git_commits_url":"https://api.github.com/repos/minio/minio-hs/git/commits{/sha}","comments_url":"https://api.github.com/repos/minio/minio-hs/comments{/number}","issue_comment_url":"https://api.github.com/repos/minio/minio-hs/issues/comments{/number}","contents_url":"https://api.github.com/repos/minio/minio-hs/contents/{+path}","compare_url":"https://api.github.com/repos/minio/minio-hs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/minio/minio-hs/merges","archive_url":"https://api.github.com/repos/minio/minio-hs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/minio/minio-hs/downloads","issues_url":"https://api.github.com/repos/minio/minio-hs/issues{/number}","pulls_url":"https://api.github.com/repos/minio/minio-hs/pulls{/number}","milestones_url":"https://api.github.com/repos/minio/minio-hs/milestones{/number}","notifications_url":"https://api.github.com/repos/minio/minio-hs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/minio/minio-hs/labels{/name}","releases_url":"https://api.github.com/repos/minio/minio-hs/releases{/id}","deployments_url":"https://api.github.com/repos/minio/minio-hs/deployments","created_at":"2017-02-13T10:19:42Z","updated_at":"2018-03-19T13:50:44Z","pushed_at":"2018-03-19T17:17:37Z","git_url":"git://github.com/minio/minio-hs.git","ssh_url":"git@github.com:minio/minio-hs.git","clone_url":"https://github.com/minio/minio-hs.git","svn_url":"https://github.com/minio/minio-hs","homepage":null,"size":278,"stargazers_count":25,"watchers_count":25,"language":"Haskell","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"archived":false,"open_issues_count":13,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":6,"open_issues":13,"watchers":25,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/minio/minio-hs/pulls/81"},"html":{"href":"https://github.com/minio/minio-hs/pull/81"},"issue":{"href":"https://api.github.com/repos/minio/minio-hs/issues/81"},"comments":{"href":"https://api.github.com/repos/minio/minio-hs/issues/81/comments"},"review_comments":{"href":"https://api.github.com/repos/minio/minio-hs/pulls/81/comments"},"review_comment":{"href":"https://api.github.com/repos/minio/minio-hs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/minio/minio-hs/pulls/81/commits"},"statuses":{"href":"https://api.github.com/repos/minio/minio-hs/statuses/72c42cbdbd7e3e0f65de7426caec62dba2429559"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"donatello"}}