mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-12-05 05:43:36 -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
@@ -16,6 +16,11 @@ 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)
|
||||
}
|
||||
|
||||
// presetZip builds what /unpack/preset/thumbnail returns: the image the preset
|
||||
// selected, and whatever bookkeeping the package carries beside it.
|
||||
func presetZip(entries map[string][]byte) []byte {
|
||||
@@ -148,9 +153,9 @@ var _ = Describe("TikaThumbnail", func() {
|
||||
|
||||
var _ = Describe("ForType with a Tika server", func() {
|
||||
const tikaURL = "http://tika:9998"
|
||||
named := thumbnail.NewTika(tikaURL, "thumbnail", thumbnail.DefaultTikaTypes, nil)
|
||||
everything := thumbnail.NewTika(tikaURL, "thumbnail", []string{"*"}, nil)
|
||||
off := thumbnail.NewTika("", "thumbnail", thumbnail.DefaultTikaTypes, nil)
|
||||
named := newTika(tikaURL, thumbnail.DefaultTikaTypes, nil)
|
||||
everything := newTika(tikaURL, []string{"*"}, nil)
|
||||
off := newTika("", thumbnail.DefaultTikaTypes, nil)
|
||||
|
||||
tika := BeAssignableToTypeOf(TikaThumbnail{})
|
||||
generator := BeNil()
|
||||
@@ -183,7 +188,7 @@ var _ = Describe("ForType with a Tika server", func() {
|
||||
}
|
||||
|
||||
It("hands the mapped type to Tika", func() {
|
||||
t := thumbnail.NewTika(tikaURL, "thumbnail", []string{"application/pdf", "image/x-nikon-nef:image/x-raw-nikon"}, nil)
|
||||
t := newTika(tikaURL, []string{"application/pdf", "image/x-nikon-nef:image/x-raw-nikon"}, nil)
|
||||
Expect(ForType("image/x-nikon-nef", Options{Tika: t}).(TikaThumbnail).contentType).To(Equal("image/x-raw-nikon"))
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user