Skip to content

Commit

Permalink
Fix to ensure specifying source_path does not download unwanted files
Browse files Browse the repository at this point in the history
  • Loading branch information
vedala committed Sep 3, 2019
1 parent 1ca7fcb commit 9655827
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion file.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ func extractFiles(zipFilePath, filesToExtractFromZipPath, localPath string) erro

// Add the path from which we will extract files to the path prefix so we can exclude the appropriate files
pathPrefix = filepath.Join(pathPrefix, filesToExtractFromZipPath)
pathPrefix = pathPrefix + "/"

// Iterate through the files in the archive,
// printing some of their contents.
Expand Down Expand Up @@ -149,4 +150,4 @@ func MakeGitHubZipFileRequest(gitHubCommit GitHubCommit, gitHubToken string, ins
}

return request, nil
}
}
1 change: 1 addition & 0 deletions file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ func TestExtractFiles(t *testing.T) {
{publicGitHub, "test-fixtures/fetch-test-public-0.0.2.zip", "/", 2, nil},
{publicGitHub, "test-fixtures/fetch-test-public-0.0.3.zip", "/", 4, []string{"/README.md"} },
{publicGitHub, "test-fixtures/fetch-test-public-0.0.3.zip", "/folder", 2, nil},
{publicGitHub, "test-fixtures/fetch-test-public-0.0.4.zip", "/aaa", 2, []string{"/hello.txt", "/subaaa/subhello.txt"} },
}

for _, tc := range cases {
Expand Down
Binary file added test-fixtures/fetch-test-public-0.0.4.zip
Binary file not shown.

0 comments on commit 9655827

Please sign in to comment.