Skip to content

Commit

Permalink
feat(sftp): allow ignore symlink error (close AlistGo#6026)
Browse files Browse the repository at this point in the history
  • Loading branch information
xhofe committed Feb 15, 2024
1 parent 6d85f1b commit 47f4b05
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions drivers/sftp/meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ type Addition struct {
PrivateKey string `json:"private_key" type:"text"`
Password string `json:"password"`
driver.RootPath
IgnoreSymlinkError bool `json:"ignore_symlink_error" default:"false" info:"Ignore symlink error"`
}

var config = driver.Config{
Expand Down
8 changes: 8 additions & 0 deletions drivers/sftp/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ func (d *SFTP) fileToObj(f os.FileInfo, dir string) (model.Obj, error) {
}
_f, err := d.client.Stat(target)
if err != nil {
if d.IgnoreSymlinkError {
return &model.Object{
Name: f.Name(),
Size: f.Size(),
Modified: f.ModTime(),
IsFolder: f.IsDir(),
}, nil
}
return nil, err
}
// set basic info
Expand Down

0 comments on commit 47f4b05

Please sign in to comment.