Commit Graph

13 Commits

Author SHA1 Message Date
Mathias Fredriksson c93b0a0af2 Refactor tests and make `toLocalPath` a method on `Server` 2022-10-18 18:17:45 +03:00
Mathias Fredriksson 7de2651135 Simplify path check in `toLocalPath` 2022-10-17 17:08:45 +03:00
Mathias Fredriksson 6a7168cf46 Add support for working directory in Server
This commit allows the working directory for the (old) Server
implementation to be changed without doing a `os.Chdir` first.

The feature can be enabled with `sftp.WithServerWorkingDirectory(dir)`
passed as an option to `sftp.NewServer`.

It is useful when the `sftp` is used as part of a larger service that
does more than just serve `sftp` and using `os.Chdir` is not an option.

The fallback behavior (when the option is not specified) is that the
path remains unmodified (as before).
2022-10-14 15:54:59 +03:00
Cassondra Foesch 71618243c4 deconvert encoded paths on windows servers 2021-06-29 15:16:15 +00:00
Fazlul Shahriar 6120cae121
Fix build on Plan 9
All test are passing on Plan 9, and I've also verified
`examples/go-sftp-server` is working.
2020-09-10 18:18:22 -04:00
Tobias Klauser 7d8a855595 Revert PR #370
This reverts commit 3cda2a1c6b / PR #370.

Reason for revert: this broke the Travis CI build, see
https://github.com/pkg/sftp/pull/370#issuecomment-678610816
2020-08-24 11:22:05 +02:00
Tobias Klauser 3cda2a1c6b Exclude test/example code in non-test builds
The fakeFileInfoSys and testOsSys funcs are only used in tests, so
rename the files they are defined in to request_*_test.go to exclude
them from non-test builds.

Also rename request-example.go to request_example_test.go to exclude it
as well, since it uses said funcs in example code.
2020-08-10 14:14:59 +02:00
Nicola Murino b4ea0fd6f6 fix lint issues
These lint issues remain:

- request-errors.go, aliases for new error types
- request-attrs.go, UidGid. Changing this will break compatibility
2019-08-30 17:04:37 +02:00
John Eikenberry 1077779d44 Revert "rename files with OS specific request test code"
Tests pass but doesn't build. :P

Need to figure out better way to organize this code.

This reverts commit 322a18e28b.
2017-03-01 20:54:40 -08:00
John Eikenberry 322a18e28b rename files with OS specific request test code
Added _test so they will only be compiled as part of the tests.
2017-03-01 19:53:59 -08:00
John Eikenberry 81c5ef6a75 rework fileinfo.Sys() output test for windows
split out the unix specific test code
2017-03-01 19:51:32 -08:00
John Eikenberry f025fae65c rework build tags for unix request test support code 2017-03-01 19:50:37 -08:00
John Eikenberry e1c86753b9 OS specific syscall.Stat_t use into separate file
The use of Stat_t in request-example.go is unix specific and broke the
Windows OS builds. This is the minimal change to fix that.

This fixes #157.
2017-02-24 20:06:51 -08:00