enhancement: introduce theme processing (#9133)
* enhancement: introduce theme processing * enhancement: introduce theme processing * enhancement: add theme processing tests and changelog * Update services/web/pkg/config/config.go Co-authored-by: Michael Barz <michael.barz@zeitgestalten.eu> * fix: ci findings * Apply suggestions from code review Co-authored-by: Martin <github@diemattels.at> * enhancement: use the theme assets from web instead of having them inside the oCis repo (license clash Apache vs. AGPLv3) * fix: golangci tagalign order * fix: rename UnifiedRoleUploader to UnifiedRoleEditorLite * fix: some typos Co-authored-by: Michael Barz <michael.barz@zeitgestalten.eu> * enhancement: export supported theme logo upload filetypes * chore: bump reva * fix: allow init func --------- Co-authored-by: Michael Barz <michael.barz@zeitgestalten.eu> Co-authored-by: Martin <github@diemattels.at>
This commit is contained in:
co-authored by
Michael Barz
Martin
parent
80480cb7fa
commit
eb7c36443f
@@ -0,0 +1,30 @@
|
||||
package theme_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"github.com/owncloud/ocis/v2/services/web/pkg/theme"
|
||||
)
|
||||
|
||||
// TestAllowedLogoFileTypes is here to ensure that a certain set of bare minimum file types are allowed for logos.
|
||||
func TestAllowedLogoFileTypes(t *testing.T) {
|
||||
type test struct {
|
||||
filename string
|
||||
mimetype string
|
||||
allowed bool
|
||||
}
|
||||
|
||||
tests := []test{
|
||||
{filename: "foo.jpg", mimetype: "image/jpeg", allowed: true},
|
||||
{filename: "foo.jpeg", mimetype: "image/jpeg", allowed: true},
|
||||
{filename: "foo.png", mimetype: "image/png", allowed: true},
|
||||
{filename: "foo.gif", mimetype: "image/gif", allowed: true},
|
||||
{filename: "foo.tiff", mimetype: "image/tiff", allowed: false},
|
||||
}
|
||||
|
||||
for _, tc := range tests {
|
||||
assert.Equal(t, theme.IsFiletypePermitted(tc.filename, tc.mimetype), tc.allowed)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user