Commit Graph

11 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 624034d7c4 Add tests for toLocalPath 2022-10-15 18:11:05 +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
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
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 c690dc3a0d mv windows only code into windows only file
related to issue #160
2017-03-01 11:22:04 -08:00