File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -772,9 +772,15 @@ func (c *Client) Remove(path string) error {
772772
773773 // Both failed: figure out which error to return.
774774
775- if errF == errD {
776- // If they are the same error, then just return that.
777- return errF
775+ if errF , ok := errF .(* os.PathError ); ok {
776+ // The only time it makes sense to compare errors, is when both are `*os.PathError`.
777+ // We cannot test these directly with errF == errD, as that would be a pointer comparison.
778+
779+ if errD , ok := errD .(* os.PathError ); ok && errors .Is (errF .Err , errD .Err ) {
780+ // If they are both pointers to PathError,
781+ // and the same underlying error, then return that.
782+ return errF
783+ }
778784 }
779785
780786 fi , err := c .Stat (path )
You can’t perform that action at this time.
0 commit comments