Files
opencloud/services/webdav/pkg/service/v0/previews_test.go
T
Dominik Schmidt 1da9fa8013 fix: answer the third review round
With previews off a thumbnail path answered 405, because the REPORT patterns match the same paths and the GET routes were left out; the routes stay now and the shared parse step answers 404, which is what the setting promises. The deprecated cache directory is read again: its default no longer sits in the config struct, where it made the fallback unreachable. A processor nobody knows is treated like none, in the parser too. A comma-joined resolutions entry in yaml keeps working. Plus the comments and the readme line that described something else than the code does.
2026-10-19 14:57:35 +02:00

28 lines
836 B
Go

package svc
import (
"net/http"
"net/http/httptest"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/opencloud-eu/opencloud/pkg/log"
"github.com/opencloud-eu/opencloud/services/webdav/pkg/config"
)
var _ = Describe("with previews disabled", func() {
// the routes stay registered, so a missing one cannot let the REPORT
// patterns answer a thumbnail request with 405
It("answers a thumbnail request with 404 before anything is parsed", func() {
g := Webdav{config: &config.Config{DisablePreviews: true}}
rec := httptest.NewRecorder()
tr, ok := g.parseThumbnailRequest(rec, httptest.NewRequest(http.MethodGet, "/dav/files/einstein/photo.png?x=32&y=32&preview=1", nil), log.NopLogger())
Expect(ok).To(BeFalse())
Expect(tr).To(BeNil())
Expect(rec.Code).To(Equal(http.StatusNotFound))
})
})