Open edugamo1993 opened 1 year ago
This is already an open change and proposal. https://github.com/pkg/sftp/pull/548
I intended to close the PR, not this issue thread. Discussion about this topic can occur here perhaps better than the PR.
But I will quote my comment from there:
I’m kind of averse to this. We probably shouldn’t have exposed RemoveDirectory in the first place. As it seems it was exported as a least-change work-around for an issue people were seeing, but a more robust solution would have been to properly address the out-of-spec situation.
In the linked issue, I covered what the correct solution should be, I just haven’t had time to implement it.
Some of our use cases require the Remove() function to return an EPERM error. Like RemoveDirectory(), I think removeFile() should be exposed and keep Remove() for use when the developer doesn't know if the resource is a file or a directory.
I tried to create a branch and a Pull Request but I don't have permissions