mirror of https://github.com/pkg/sftp.git
Revert "have Stat() mimic os.Stat()'s error"
did this to make sure client received file not found error. changed things so previous os.ErrNotExist works.
This commit is contained in:
parent
69cd74c3d1
commit
b387807529
|
@ -100,6 +100,7 @@ func (fs *root) Fileinfo(r *Request) ([]os.FileInfo, error) {
|
|||
switch r.Method {
|
||||
case "List":
|
||||
list := []os.FileInfo{}
|
||||
fmt.Println("ls", r.Filepath)
|
||||
for fn, fi := range fs.files {
|
||||
if filepath.Dir(fn) == r.Filepath {
|
||||
fmt.Println(fn, fi.Name())
|
||||
|
@ -110,8 +111,7 @@ func (fs *root) Fileinfo(r *Request) ([]os.FileInfo, error) {
|
|||
case "Stat":
|
||||
file, err := fs.fetch(r.Filepath)
|
||||
if err != nil {
|
||||
// mimic os.Stat() return error
|
||||
return nil, &os.PathError{"stat", r.Filepath, syscall.ENOENT}
|
||||
return nil, err
|
||||
}
|
||||
return []os.FileInfo{file}, nil
|
||||
case "Readlink":
|
||||
|
|
Loading…
Reference in New Issue