{"action":"created","comment":{"url":"https://api.github.com/repos/rtfpessoa/coursier-s3/pulls/comments/71979093","id":71979093,"diff_hunk":"@@ -0,0 +1,123 @@\n+package coursier.cache.protocol\n+\n+import java.io.{File, PrintWriter}\n+import java.net.URL\n+import java.nio.charset.CodingErrorAction\n+import java.nio.file.{Files, Path}\n+import java.util.stream.Collectors\n+\n+import awscala.s3.Bucket\n+import utest._\n+\n+import scala.collection.JavaConversions._\n+import scala.io.{Codec, Source}\n+import scala.util.Try\n+\n+object S3cHandlerTest extends TestSuite {\n+\n+  implicit val codec = Codec(\"UTF-8\")\n+  codec.onMalformedInput(CodingErrorAction.REPLACE)\n+  codec.onUnmappableCharacter(CodingErrorAction.REPLACE)\n+\n+  val tests = withTmpDir { tmpPath =>\n+\n+    S3Client.setEndpoint(\"http://localhost:4568\")\n+\n+    val bucket = Bucket(\"test-s3-coursier-com\")\n+\n+    val directory = tmpPath.resolve(\"directory\").toFile\n+    directory.mkdirs()\n+    val file1 = tmpPath.resolve(\"file1.jar\").toFile\n+    val file2 = tmpPath.resolve(\"directory/file2.jar\").toFile\n+    val file3 = tmpPath.resolve(\"directory/file3.jar\").toFile\n+\n+    write(file1, \"File 1\")\n+    write(file2, \"File 2\")\n+    write(file3, \"File 3\")\n+\n+    S3Client.instance.put(bucket, \"file1.jar\", file1)\n+    S3Client.instance.put(bucket, \"directory/file2.jar\", file2)\n+    S3Client.instance.put(bucket, \"directory/file3.jar\", file3)\n+\n+    S3cHandler.setupS3Handler()\n+    val s3cHandler = new S3cHandler()\n+\n+    this {\n+      'test1 {\n+        val file1Url = new URL(\"s3c://localhost:4568/test-s3-coursier-com/file1.jar\")\n+        val is = s3cHandler.openConnection(file1Url).getInputStream\n+\n+        val lines = Source.fromInputStream(is).getLines().toList\n+\n+        is.close()\n+\n+        assert(lines == List(\"File 1\"))\n+      }\n+      'test2 {\n+        val directoryUrl = new URL(\"s3c://localhost:4568/test-s3-coursier-com/directory/\")\n+        val is = s3cHandler.openConnection(directoryUrl).getInputStream\n+\n+        val htmlBody =\n+          s\"\"\"\n+             |<html>\n+             |<head>\n+             |</head>\n+             |<body>\n+             |<pre><a href=\":directory/file2.jar\">directory/file2.jar</a></pre>\n+             |<pre><a href=\":directory/file3.jar\">directory/file3.jar</a></pre>\n+             |</body>","path":"src/test/scala/coursier/cache/protocol/S3cHandlerTest.scala","position":null,"original_position":68,"commit_id":"243ab811dafb92f2b412b89903eaca9b2c892139","original_commit_id":"7d10ea793b63b8b4d1cae645cceee0b82a457881","user":{"login":"rtfpessoa","id":902384,"avatar_url":"https://avatars.githubusercontent.com/u/902384?v=3","gravatar_id":"","url":"https://api.github.com/users/rtfpessoa","html_url":"https://github.com/rtfpessoa","followers_url":"https://api.github.com/users/rtfpessoa/followers","following_url":"https://api.github.com/users/rtfpessoa/following{/other_user}","gists_url":"https://api.github.com/users/rtfpessoa/gists{/gist_id}","starred_url":"https://api.github.com/users/rtfpessoa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rtfpessoa/subscriptions","organizations_url":"https://api.github.com/users/rtfpessoa/orgs","repos_url":"https://api.github.com/users/rtfpessoa/repos","events_url":"https://api.github.com/users/rtfpessoa/events{/privacy}","received_events_url":"https://api.github.com/users/rtfpessoa/received_events","type":"User","site_admin":false},"body":"After the bug you found everything seems fine with the plugin.\r\n\r\nWhat I mean is kind of related to https://github.com/alexarchambault/coursier/issues/164#issuecomment-233132445 since that is related to me trying to understand why coursier is asking weird directories in s3 with ivy.\r\n\r\nAfter your recent changes to clean ivy I did a coursier build locally and I got an exception that I wrote in gitter. Can you take a look?","created_at":"2016-07-23T22:20:47Z","updated_at":"2016-07-23T22:20:47Z","html_url":"https://github.com/rtfpessoa/coursier-s3/pull/2#discussion_r71979093","pull_request_url":"https://api.github.com/repos/rtfpessoa/coursier-s3/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/rtfpessoa/coursier-s3/pulls/comments/71979093"},"html":{"href":"https://github.com/rtfpessoa/coursier-s3/pull/2#discussion_r71979093"},"pull_request":{"href":"https://api.github.com/repos/rtfpessoa/coursier-s3/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/rtfpessoa/coursier-s3/pulls/2","id":73501868,"html_url":"https://github.com/rtfpessoa/coursier-s3/pull/2","diff_url":"https://github.com/rtfpessoa/coursier-s3/pull/2.diff","patch_url":"https://github.com/rtfpessoa/coursier-s3/pull/2.patch","issue_url":"https://api.github.com/repos/rtfpessoa/coursier-s3/issues/2","number":2,"state":"open","locked":false,"title":"Support s3 directories","user":{"login":"rtfpessoa","id":902384,"avatar_url":"https://avatars.githubusercontent.com/u/902384?v=3","gravatar_id":"","url":"https://api.github.com/users/rtfpessoa","html_url":"https://github.com/rtfpessoa","followers_url":"https://api.github.com/users/rtfpessoa/followers","following_url":"https://api.github.com/users/rtfpessoa/following{/other_user}","gists_url":"https://api.github.com/users/rtfpessoa/gists{/gist_id}","starred_url":"https://api.github.com/users/rtfpessoa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rtfpessoa/subscriptions","organizations_url":"https://api.github.com/users/rtfpessoa/orgs","repos_url":"https://api.github.com/users/rtfpessoa/repos","events_url":"https://api.github.com/users/rtfpessoa/events{/privacy}","received_events_url":"https://api.github.com/users/rtfpessoa/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-06-12T17:30:25Z","updated_at":"2016-07-23T22:20:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"292b3325ed6953002bac2e0acd120aa19d41d1c2","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/rtfpessoa/coursier-s3/pulls/2/commits","review_comments_url":"https://api.github.com/repos/rtfpessoa/coursier-s3/pulls/2/comments","review_comment_url":"https://api.github.com/repos/rtfpessoa/coursier-s3/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rtfpessoa/coursier-s3/issues/2/comments","statuses_url":"https://api.github.com/repos/rtfpessoa/coursier-s3/statuses/243ab811dafb92f2b412b89903eaca9b2c892139","head":{"label":"rtfpessoa:support-s3-directories","ref":"support-s3-directories","sha":"243ab811dafb92f2b412b89903eaca9b2c892139","user":{"login":"rtfpessoa","id":902384,"avatar_url":"https://avatars.githubusercontent.com/u/902384?v=3","gravatar_id":"","url":"https://api.github.com/users/rtfpessoa","html_url":"https://github.com/rtfpessoa","followers_url":"https://api.github.com/users/rtfpessoa/followers","following_url":"https://api.github.com/users/rtfpessoa/following{/other_user}","gists_url":"https://api.github.com/users/rtfpessoa/gists{/gist_id}","starred_url":"https://api.github.com/users/rtfpessoa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rtfpessoa/subscriptions","organizations_url":"https://api.github.com/users/rtfpessoa/orgs","repos_url":"https://api.github.com/users/rtfpessoa/repos","events_url":"https://api.github.com/users/rtfpessoa/events{/privacy}","received_events_url":"https://api.github.com/users/rtfpessoa/received_events","type":"User","site_admin":false},"repo":{"id":59662347,"name":"coursier-s3","full_name":"rtfpessoa/coursier-s3","owner":{"login":"rtfpessoa","id":902384,"avatar_url":"https://avatars.githubusercontent.com/u/902384?v=3","gravatar_id":"","url":"https://api.github.com/users/rtfpessoa","html_url":"https://github.com/rtfpessoa","followers_url":"https://api.github.com/users/rtfpessoa/followers","following_url":"https://api.github.com/users/rtfpessoa/following{/other_user}","gists_url":"https://api.github.com/users/rtfpessoa/gists{/gist_id}","starred_url":"https://api.github.com/users/rtfpessoa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rtfpessoa/subscriptions","organizations_url":"https://api.github.com/users/rtfpessoa/orgs","repos_url":"https://api.github.com/users/rtfpessoa/repos","events_url":"https://api.github.com/users/rtfpessoa/events{/privacy}","received_events_url":"https://api.github.com/users/rtfpessoa/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rtfpessoa/coursier-s3","description":"S3 Coursier Plugin","fork":false,"url":"https://api.github.com/repos/rtfpessoa/coursier-s3","forks_url":"https://api.github.com/repos/rtfpessoa/coursier-s3/forks","keys_url":"https://api.github.com/repos/rtfpessoa/coursier-s3/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rtfpessoa/coursier-s3/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rtfpessoa/coursier-s3/teams","hooks_url":"https://api.github.com/repos/rtfpessoa/coursier-s3/hooks","issue_events_url":"https://api.github.com/repos/rtfpessoa/coursier-s3/issues/events{/number}","events_url":"https://api.github.com/repos/rtfpessoa/coursier-s3/events","assignees_url":"https://api.github.com/repos/rtfpessoa/coursier-s3/assignees{/user}","branches_url":"https://api.github.com/repos/rtfpessoa/coursier-s3/branches{/branch}","tags_url":"https://api.github.com/repos/rtfpessoa/coursier-s3/tags","blobs_url":"https://api.github.com/repos/rtfpessoa/coursier-s3/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rtfpessoa/coursier-s3/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rtfpessoa/coursier-s3/git/refs{/sha}","trees_url":"https://api.github.com/repos/rtfpessoa/coursier-s3/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rtfpessoa/coursier-s3/statuses/{sha}","languages_url":"https://api.github.com/repos/rtfpessoa/coursier-s3/languages","stargazers_url":"https://api.github.com/repos/rtfpessoa/coursier-s3/stargazers","contributors_url":"https://api.github.com/repos/rtfpessoa/coursier-s3/contributors","subscribers_url":"https://api.github.com/repos/rtfpessoa/coursier-s3/subscribers","subscription_url":"https://api.github.com/repos/rtfpessoa/coursier-s3/subscription","commits_url":"https://api.github.com/repos/rtfpessoa/coursier-s3/commits{/sha}","git_commits_url":"https://api.github.com/repos/rtfpessoa/coursier-s3/git/commits{/sha}","comments_url":"https://api.github.com/repos/rtfpessoa/coursier-s3/comments{/number}","issue_comment_url":"https://api.github.com/repos/rtfpessoa/coursier-s3/issues/comments{/number}","contents_url":"https://api.github.com/repos/rtfpessoa/coursier-s3/contents/{+path}","compare_url":"https://api.github.com/repos/rtfpessoa/coursier-s3/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rtfpessoa/coursier-s3/merges","archive_url":"https://api.github.com/repos/rtfpessoa/coursier-s3/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rtfpessoa/coursier-s3/downloads","issues_url":"https://api.github.com/repos/rtfpessoa/coursier-s3/issues{/number}","pulls_url":"https://api.github.com/repos/rtfpessoa/coursier-s3/pulls{/number}","milestones_url":"https://api.github.com/repos/rtfpessoa/coursier-s3/milestones{/number}","notifications_url":"https://api.github.com/repos/rtfpessoa/coursier-s3/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rtfpessoa/coursier-s3/labels{/name}","releases_url":"https://api.github.com/repos/rtfpessoa/coursier-s3/releases{/id}","deployments_url":"https://api.github.com/repos/rtfpessoa/coursier-s3/deployments","created_at":"2016-05-25T12:43:54Z","updated_at":"2016-06-02T14:18:57Z","pushed_at":"2016-07-23T17:40:31Z","git_url":"git://github.com/rtfpessoa/coursier-s3.git","ssh_url":"git@github.com:rtfpessoa/coursier-s3.git","clone_url":"https://github.com/rtfpessoa/coursier-s3.git","svn_url":"https://github.com/rtfpessoa/coursier-s3","homepage":"https://github.com/rtfpessoa/coursier-s3","size":17,"stargazers_count":4,"watchers_count":4,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":4,"default_branch":"master"}},"base":{"label":"rtfpessoa:master","ref":"master","sha":"9fe16e88daf3bcd17ef1ede72b24a3dcd23b5016","user":{"login":"rtfpessoa","id":902384,"avatar_url":"https://avatars.githubusercontent.com/u/902384?v=3","gravatar_id":"","url":"https://api.github.com/users/rtfpessoa","html_url":"https://github.com/rtfpessoa","followers_url":"https://api.github.com/users/rtfpessoa/followers","following_url":"https://api.github.com/users/rtfpessoa/following{/other_user}","gists_url":"https://api.github.com/users/rtfpessoa/gists{/gist_id}","starred_url":"https://api.github.com/users/rtfpessoa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rtfpessoa/subscriptions","organizations_url":"https://api.github.com/users/rtfpessoa/orgs","repos_url":"https://api.github.com/users/rtfpessoa/repos","events_url":"https://api.github.com/users/rtfpessoa/events{/privacy}","received_events_url":"https://api.github.com/users/rtfpessoa/received_events","type":"User","site_admin":false},"repo":{"id":59662347,"name":"coursier-s3","full_name":"rtfpessoa/coursier-s3","owner":{"login":"rtfpessoa","id":902384,"avatar_url":"https://avatars.githubusercontent.com/u/902384?v=3","gravatar_id":"","url":"https://api.github.com/users/rtfpessoa","html_url":"https://github.com/rtfpessoa","followers_url":"https://api.github.com/users/rtfpessoa/followers","following_url":"https://api.github.com/users/rtfpessoa/following{/other_user}","gists_url":"https://api.github.com/users/rtfpessoa/gists{/gist_id}","starred_url":"https://api.github.com/users/rtfpessoa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rtfpessoa/subscriptions","organizations_url":"https://api.github.com/users/rtfpessoa/orgs","repos_url":"https://api.github.com/users/rtfpessoa/repos","events_url":"https://api.github.com/users/rtfpessoa/events{/privacy}","received_events_url":"https://api.github.com/users/rtfpessoa/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rtfpessoa/coursier-s3","description":"S3 Coursier Plugin","fork":false,"url":"https://api.github.com/repos/rtfpessoa/coursier-s3","forks_url":"https://api.github.com/repos/rtfpessoa/coursier-s3/forks","keys_url":"https://api.github.com/repos/rtfpessoa/coursier-s3/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rtfpessoa/coursier-s3/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rtfpessoa/coursier-s3/teams","hooks_url":"https://api.github.com/repos/rtfpessoa/coursier-s3/hooks","issue_events_url":"https://api.github.com/repos/rtfpessoa/coursier-s3/issues/events{/number}","events_url":"https://api.github.com/repos/rtfpessoa/coursier-s3/events","assignees_url":"https://api.github.com/repos/rtfpessoa/coursier-s3/assignees{/user}","branches_url":"https://api.github.com/repos/rtfpessoa/coursier-s3/branches{/branch}","tags_url":"https://api.github.com/repos/rtfpessoa/coursier-s3/tags","blobs_url":"https://api.github.com/repos/rtfpessoa/coursier-s3/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rtfpessoa/coursier-s3/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rtfpessoa/coursier-s3/git/refs{/sha}","trees_url":"https://api.github.com/repos/rtfpessoa/coursier-s3/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rtfpessoa/coursier-s3/statuses/{sha}","languages_url":"https://api.github.com/repos/rtfpessoa/coursier-s3/languages","stargazers_url":"https://api.github.com/repos/rtfpessoa/coursier-s3/stargazers","contributors_url":"https://api.github.com/repos/rtfpessoa/coursier-s3/contributors","subscribers_url":"https://api.github.com/repos/rtfpessoa/coursier-s3/subscribers","subscription_url":"https://api.github.com/repos/rtfpessoa/coursier-s3/subscription","commits_url":"https://api.github.com/repos/rtfpessoa/coursier-s3/commits{/sha}","git_commits_url":"https://api.github.com/repos/rtfpessoa/coursier-s3/git/commits{/sha}","comments_url":"https://api.github.com/repos/rtfpessoa/coursier-s3/comments{/number}","issue_comment_url":"https://api.github.com/repos/rtfpessoa/coursier-s3/issues/comments{/number}","contents_url":"https://api.github.com/repos/rtfpessoa/coursier-s3/contents/{+path}","compare_url":"https://api.github.com/repos/rtfpessoa/coursier-s3/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rtfpessoa/coursier-s3/merges","archive_url":"https://api.github.com/repos/rtfpessoa/coursier-s3/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rtfpessoa/coursier-s3/downloads","issues_url":"https://api.github.com/repos/rtfpessoa/coursier-s3/issues{/number}","pulls_url":"https://api.github.com/repos/rtfpessoa/coursier-s3/pulls{/number}","milestones_url":"https://api.github.com/repos/rtfpessoa/coursier-s3/milestones{/number}","notifications_url":"https://api.github.com/repos/rtfpessoa/coursier-s3/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rtfpessoa/coursier-s3/labels{/name}","releases_url":"https://api.github.com/repos/rtfpessoa/coursier-s3/releases{/id}","deployments_url":"https://api.github.com/repos/rtfpessoa/coursier-s3/deployments","created_at":"2016-05-25T12:43:54Z","updated_at":"2016-06-02T14:18:57Z","pushed_at":"2016-07-23T17:40:31Z","git_url":"git://github.com/rtfpessoa/coursier-s3.git","ssh_url":"git@github.com:rtfpessoa/coursier-s3.git","clone_url":"https://github.com/rtfpessoa/coursier-s3.git","svn_url":"https://github.com/rtfpessoa/coursier-s3","homepage":"https://github.com/rtfpessoa/coursier-s3","size":17,"stargazers_count":4,"watchers_count":4,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rtfpessoa/coursier-s3/pulls/2"},"html":{"href":"https://github.com/rtfpessoa/coursier-s3/pull/2"},"issue":{"href":"https://api.github.com/repos/rtfpessoa/coursier-s3/issues/2"},"comments":{"href":"https://api.github.com/repos/rtfpessoa/coursier-s3/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/rtfpessoa/coursier-s3/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/rtfpessoa/coursier-s3/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rtfpessoa/coursier-s3/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/rtfpessoa/coursier-s3/statuses/243ab811dafb92f2b412b89903eaca9b2c892139"}}}}
{"actor":{"display_login":"rtfpessoa"}}