mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-12-05 14:39:23 -05:00
fix(webdav): trim the Tika thumbnail preset once in Sanitize
The check trimmed the preset but the URL took it untrimmed, so " thumbnail" started fine and then answered 404 for /unpack/preset/%20thumbnail. Sanitize trims it now and Validate only compares against "". The tests build their Tika through a helper that sets the default preset.
This commit is contained in:
1 parent
17a9874be2
commit
0ac1ea8e30
5 files changed
+38
-13
No files matched your search
@@ -7,14 +7,19 @@ import (
|
||||
"github.com/opencloud-eu/opencloud/services/webdav/pkg/thumbnail"
|
||||
)
|
||||
|
||||
// newTika builds a Tika with the default preset, which these tests do not vary.
|
||||
func newTika(url string, mimeTypes, additional []string) thumbnail.Tika {
|
||||
return thumbnail.NewTika(url, "thumbnail", mimeTypes, additional)
|
||||
}
|
||||
|
||||
var _ = Describe("Tika", func() {
|
||||
none := thumbnail.NewTika("", "thumbnail", thumbnail.DefaultTikaTypes, nil)
|
||||
all := thumbnail.NewTika("http://tika:9998", "thumbnail", []string{"*"}, nil)
|
||||
nothing := thumbnail.NewTika("http://tika:9998", "thumbnail", nil, nil)
|
||||
some := thumbnail.NewTika("http://tika:9998", "thumbnail", []string{" Application/PDF ", "audio/mpeg", "image/x-nikon-nef:image/x-raw-nikon"}, nil)
|
||||
built := thumbnail.NewTika("http://tika:9998", "thumbnail", thumbnail.DefaultTikaTypes, nil)
|
||||
extended := thumbnail.NewTika("http://tika:9998", "thumbnail", thumbnail.DefaultTikaTypes, []string{"application/zip", "image/heic"})
|
||||
extendedAll := thumbnail.NewTika("http://tika:9998", "thumbnail", thumbnail.DefaultTikaTypes, []string{"*"})
|
||||
none := newTika("", thumbnail.DefaultTikaTypes, nil)
|
||||
all := newTika("http://tika:9998", []string{"*"}, nil)
|
||||
nothing := newTika("http://tika:9998", nil, nil)
|
||||
some := newTika("http://tika:9998", []string{" Application/PDF ", "audio/mpeg", "image/x-nikon-nef:image/x-raw-nikon"}, nil)
|
||||
built := newTika("http://tika:9998", thumbnail.DefaultTikaTypes, nil)
|
||||
extended := newTika("http://tika:9998", thumbnail.DefaultTikaTypes, []string{"application/zip", "image/heic"})
|
||||
extendedAll := newTika("http://tika:9998", thumbnail.DefaultTikaTypes, []string{"*"})
|
||||
|
||||
DescribeTable("Supports",
|
||||
func(tika thumbnail.Tika, mimeType string, want bool) {
|
||||
|
||||
Reference in new issue
Block a user