fix the error message for errors that occur during file transfers

we should special case path errors and replace the fs path with the
virtual path.

Thanks to @nezzzumi for reporting this issue

Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
Nicola Murino
2024-05-10 16:04:44 +02:00
parent a6a92f0d69
commit a73c6569f9
4 changed files with 20 additions and 4 deletions

View File

@@ -16,6 +16,8 @@ package common
import (
"errors"
"fmt"
"io/fs"
"path"
"sync"
"sync/atomic"
@@ -220,6 +222,10 @@ func (t *BaseTransfer) ConvertError(err error) error {
} else if t.Fs.IsPermission(err) {
return t.Connection.GetPermissionDeniedError()
}
var pathError *fs.PathError
if errors.As(err, &pathError) {
return fmt.Errorf("%s %s: %s", pathError.Op, t.GetVirtualPath(), pathError.Err.Error())
}
return err
}