[full-ci] enhancement: allow ocis to provide custom web applications (#8523)
* enhancement: allow ocis to provide custom web applications * enhancement: add an option to disable web apps * test: add default logger tests * test: add app loading tests * test: add asset server tests * enhancement: make use of dedicated app conf file and app asset paths * enhancement: adjust asset locations and deprecate WEB_ASSET_PATH * enhancement: get rid of default logger and use the service level logger instead * Apply suggestions from code review Co-authored-by: Benedikt Kulmann <benedikt@kulmann.biz> Co-authored-by: kobergj <juliankoberg@googlemail.com> * enhancement: use basename as app id * Apply suggestions from code review Co-authored-by: Martin <github@diemattels.at> * enhancement: use afero as fs abstraction * enhancement: simplify logo upload * enhancement: make use of introductionVersion field annotations --------- Co-authored-by: Benedikt Kulmann <benedikt@kulmann.biz> Co-authored-by: kobergj <juliankoberg@googlemail.com> Co-authored-by: Martin <github@diemattels.at>
This commit is contained in:
co-authored by
Benedikt Kulmann
kobergj
Martin
parent
6ba9e4adf7
commit
6814c61506
@@ -0,0 +1,65 @@
|
||||
package filepathx_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/x/path/filepathx"
|
||||
)
|
||||
|
||||
func TestJailJoin(t *testing.T) {
|
||||
type args struct {
|
||||
jail string
|
||||
elem []string
|
||||
}
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
args args
|
||||
want string
|
||||
}{
|
||||
{
|
||||
name: "regular use case",
|
||||
args: args{
|
||||
jail: "/",
|
||||
elem: []string{"a", "b", "c"},
|
||||
},
|
||||
want: "/a/b/c",
|
||||
},
|
||||
{
|
||||
name: "access parent directory",
|
||||
args: args{
|
||||
jail: "/",
|
||||
elem: []string{"a", "b", "c", ".."},
|
||||
},
|
||||
want: "/a/b",
|
||||
},
|
||||
{
|
||||
name: "restrict breaking out of jail",
|
||||
args: args{
|
||||
jail: "/",
|
||||
elem: []string{"a", "b", "c", "..", "..", "..", "..", "..", "..", ".."},
|
||||
},
|
||||
want: "/",
|
||||
},
|
||||
{
|
||||
name: "restrict to child of jail",
|
||||
args: args{
|
||||
jail: "/a/b",
|
||||
elem: []string{"a", "b", "c", "..", "..", "..", "..", "..", "..", ".."},
|
||||
},
|
||||
want: "/a/b",
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
tt := tt
|
||||
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
if got := filepathx.JailJoin(tt.args.jail, tt.args.elem...); got != tt.want {
|
||||
t.Errorf("JailJoin() = %v, want %v", got, tt.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user