mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-07 06:40:54 +03:00
sftpd: minor improvements and docs for the prefix middleware
This commit is contained in:
@@ -2061,3 +2061,26 @@ func newFakeListener(err error) net.Listener {
|
||||
err: err,
|
||||
}
|
||||
}
|
||||
|
||||
func TestFolderPrefix(t *testing.T) {
|
||||
c := Configuration{
|
||||
FolderPrefix: "files",
|
||||
}
|
||||
c.checkFolderPrefix()
|
||||
assert.Equal(t, "/files", c.FolderPrefix)
|
||||
c.FolderPrefix = ""
|
||||
c.checkFolderPrefix()
|
||||
assert.Empty(t, c.FolderPrefix)
|
||||
c.FolderPrefix = "/"
|
||||
c.checkFolderPrefix()
|
||||
assert.Empty(t, c.FolderPrefix)
|
||||
c.FolderPrefix = "/."
|
||||
c.checkFolderPrefix()
|
||||
assert.Empty(t, c.FolderPrefix)
|
||||
c.FolderPrefix = "."
|
||||
c.checkFolderPrefix()
|
||||
assert.Empty(t, c.FolderPrefix)
|
||||
c.FolderPrefix = ".."
|
||||
c.checkFolderPrefix()
|
||||
assert.Empty(t, c.FolderPrefix)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user