Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RealPathFileLister #448

Closed
d4z3x opened this issue Jun 30, 2021 · 2 comments
Closed

RealPathFileLister #448

d4z3x opened this issue Jun 30, 2021 · 2 comments

Comments

@d4z3x
Copy link

d4z3x commented Jun 30, 2021

How do I use this interface to customize the start directory?

type RealPathFileLister interface {
	FileLister
	RealPath(string) string
}

I do see this in request-example.go:

// implements RealpathFileLister interface
func (fs *root) Realpath(p string) string {
	fs.startDirectory = "/test"

	if fs.startDirectory == "" || fs.startDirectory == "/" {
		return cleanPath(p)
	}
	return cleanPathWithBase(fs.startDirectory, p)
}

Do I implement the RealPath method and change the dir there? My apologies in advance for asking a basic question.

@drakkan
Copy link
Collaborator

drakkan commented Feb 23, 2022

Hi,

yes do you need to implement the RealpathFileLister interface and returns the response for the SSH_FXP_REALPATH request from there. This way you can implement the start directory logic.

@drakkan
Copy link
Collaborator

drakkan commented Mar 2, 2022

RealpathFileLister works only with smart clients, I proposed a better approach in #498

@drakkan drakkan closed this as completed Mar 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants