pkg / sftp

SFTP support for the go.crypto/ssh package
BSD 2-Clause "Simplified" License
1.51k stars 380 forks source link

proposal/exposeRemoveFile #555

Open edugamo1993 opened 1 year ago

edugamo1993 commented 1 year ago

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

puellanivis commented 1 year ago

This is already an open change and proposal. https://github.com/pkg/sftp/pull/548

puellanivis commented 1 year ago

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.