diff --git a/changelog/unreleased/preview-api.md b/changelog/unreleased/preview-api.md new file mode 100644 index 0000000000..1da2b5c50d --- /dev/null +++ b/changelog/unreleased/preview-api.md @@ -0,0 +1,5 @@ +Enhancement: implement preview API + +Added the API endpoint for file previews. + +https://github.com/owncloud/ocis-webdav/pull/13 diff --git a/pkg/dav/thumbnails/thumbnail.go b/pkg/dav/thumbnails/thumbnail.go index 6e6646ef4f..e8ba4b1348 100644 --- a/pkg/dav/thumbnails/thumbnail.go +++ b/pkg/dav/thumbnails/thumbnail.go @@ -11,8 +11,10 @@ import ( ) const ( - // DefaultSize defines the default width and height of a thumbnail - DefaultSize = 32 + // DefaultWidth defines the default width of a thumbnail + DefaultWidth = 32 + // DefaultHeight defines the default height of a thumbnail + DefaultHeight = 32 ) // Request combines all parameters provided when requesting a thumbnail @@ -31,11 +33,11 @@ func NewRequest(r *http.Request) (Request, error) { query := r.URL.Query() width, err := strconv.Atoi(query.Get("x")) if err != nil { - width = DefaultSize + width = DefaultWidth } height, err := strconv.Atoi(query.Get("y")) if err != nil { - height = DefaultSize + height = DefaultHeight } etag := query.Get("c") diff --git a/pkg/service/v0/instrument.go b/pkg/service/v0/instrument.go index ac606a72ad..7f3bcaedc1 100644 --- a/pkg/service/v0/instrument.go +++ b/pkg/service/v0/instrument.go @@ -24,7 +24,7 @@ func (i instrument) ServeHTTP(w http.ResponseWriter, r *http.Request) { i.next.ServeHTTP(w, r) } -// Dummy implements the Service interface. +// Thumbnail implements the Service interface. func (i instrument) Thumbnail(w http.ResponseWriter, r *http.Request) { i.next.Thumbnail(w, r) } diff --git a/pkg/service/v0/tracing.go b/pkg/service/v0/tracing.go index 57ec3ec4cc..6deb60a37d 100644 --- a/pkg/service/v0/tracing.go +++ b/pkg/service/v0/tracing.go @@ -20,7 +20,7 @@ func (t tracing) ServeHTTP(w http.ResponseWriter, r *http.Request) { t.next.ServeHTTP(w, r) } -// Dummy implements the Service interface. +// Thumbnail implements the Service interface. func (t tracing) Thumbnail(w http.ResponseWriter, r *http.Request) { t.next.Thumbnail(w, r) }