Skip to content

Fix an issue with trailing path separators in the --cache-dir argument. #23

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 24, 2020

Conversation

chrisgavin
Copy link
Collaborator

This fixes an issue where using a non-existent cache directory behaves differently depending on whether it has a trailing slash.

Before this change, using a trailing slash would always give an error because we check if the parent (as determined by filepath.Dir(...) exists before creating the cache directory. When a path has a trailing slash, filepath.Dir(...) returns the input path. This is a Go bug in my opinion.

To work around this issue, I've called filepath.Clean(...) on the path before we initialize the cache, which strips any trailing slashes. I've also added a test for this case.

@chrisgavin chrisgavin merged commit 19e5eef into main Aug 24, 2020
@chrisgavin chrisgavin deleted the fix-cachedir-trailing-slash branch August 24, 2020 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant