Skip to content

🐛 Ensure that there is an explicit check that a path is not a directory before unlinking#886

Closed
joshjennings98 wants to merge 2 commits into
masterfrom
check-dir-on-unlink
Closed

🐛 Ensure that there is an explicit check that a path is not a directory before unlinking#886
joshjennings98 wants to merge 2 commits into
masterfrom
check-dir-on-unlink

Conversation

@joshjennings98
Copy link
Copy Markdown
Contributor

Description

Ensure that there is an explicit check that a path is not a directory before unlinking.

The check for an error with "is a directory" (EISDIR) is not robust enough. On MacOS, the error is ERPERM which means that Remove fails tests on MacOS.

Test Coverage

  • This change is covered by existing or additional automated tests.
  • Manual testing has been performed (and evidence provided) as automated testing was not feasible.
  • Additional tests are not required for this change (e.g. documentation update).

err = commonerrors.IgnoreCorrespondTo(err, "is a directory")
info, err := c.Stat(name)
if err != nil {
err = ConvertFileSystemError(err)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if error is notFound the error should be ignored

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