Skip to content

Conversation

@chrisgavin
Copy link
Contributor

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.

2 participants