Closed vedala closed 5 years ago
@brikis98 thanks for your comments.
I agree that appending a literal "/"
could be highly OS/platform dependent.
I will work on finding a solution based on your suggestion - converting f.name
and pathPrefix
to canonical paths and comparing them.
Also wanted to respond to your comment about trailing slash being present in the --source-path
arg.
In the line just above the line I added, the call to filepath.Join()
removes any trailing slashes. I thought I would quickly mention.
I updated the code to what I believe handles all cases now.
I am using continue
to skip specific cases in for
loop instead of using a if
check. I felt this resulted in simpler if
conditions. I also retained the original indentation so that unmodified code does not show up in diff.
Please see the comments in code for an explanation how I check for each case.
Tests passed. Merging.
Thanks!
This PR fixes issue #37 .
The extractFiles function needed a very simple change to fix this issue. Since source-path specifies a folder, appending a "/" to pathPrefix variable makes sure that we download only files from within the folder specified in source-path.
I also added a zip file to test-fixtures folder which ensures that the test scenario specified in the issue description is tested.