From bc2569e811da82bc3330bcdad405813f90aa0016 Mon Sep 17 00:00:00 2001 From: Michael Barz Date: Mon, 16 May 2022 12:26:12 +0200 Subject: [PATCH 1/3] add productversion to keep legacy version --- internal/http/services/owncloud/ocdav/ocdav.go | 5 +++++ internal/http/services/owncloud/ocdav/status.go | 1 + internal/http/services/owncloud/ocs/data/capabilities.go | 1 + pkg/micro/ocdav/option.go | 7 +++++++ 4 files changed, 14 insertions(+) diff --git a/internal/http/services/owncloud/ocdav/ocdav.go b/internal/http/services/owncloud/ocdav/ocdav.go index 5aa324a4a0..140928d799 100644 --- a/internal/http/services/owncloud/ocdav/ocdav.go +++ b/internal/http/services/owncloud/ocdav/ocdav.go @@ -101,6 +101,7 @@ type Config struct { Edition string `mapstructure:"edition"` Product string `mapstructure:"product"` ProductName string `mapstructure:"product_name"` + ProductVersion string `mapstructure:"product_version"` } func (c *Config) init() { @@ -127,6 +128,10 @@ func (c *Config) init() { c.ProductName = "reva" } + if c.ProductVersion == "" { + c.ProductVersion = "10.0.11" + } + if c.Edition == "" { c.Edition = "community" } diff --git a/internal/http/services/owncloud/ocdav/status.go b/internal/http/services/owncloud/ocdav/status.go index 067f339fc7..282a97055b 100644 --- a/internal/http/services/owncloud/ocdav/status.go +++ b/internal/http/services/owncloud/ocdav/status.go @@ -36,6 +36,7 @@ func (s *svc) doStatus(w http.ResponseWriter, r *http.Request) { VersionString: s.c.VersionString, Edition: s.c.Edition, ProductName: s.c.ProductName, + ProductVersion: s.c.ProductVersion, Product: s.c.Product, } diff --git a/internal/http/services/owncloud/ocs/data/capabilities.go b/internal/http/services/owncloud/ocs/data/capabilities.go index 7a39706243..41cd910c9a 100644 --- a/internal/http/services/owncloud/ocs/data/capabilities.go +++ b/internal/http/services/owncloud/ocs/data/capabilities.go @@ -86,6 +86,7 @@ type Status struct { Edition string `json:"edition" xml:"edition"` ProductName string `json:"productname" xml:"productname"` Product string `json:"product" xml:"product"` + ProductVersion string `json:"productversion" xml:"productversion"` Hostname string `json:"hostname,omitempty" xml:"hostname,omitempty"` } diff --git a/pkg/micro/ocdav/option.go b/pkg/micro/ocdav/option.go index efbc85ab0b..386542e639 100644 --- a/pkg/micro/ocdav/option.go +++ b/pkg/micro/ocdav/option.go @@ -218,3 +218,10 @@ func ProductName(val string) Option { o.config.ProductName = val } } + +// ProductVersion provides a function to set the ProductVersion config option. +func ProductVersion(val string) Option { + return func(o *Options) { + o.config.ProductVersion = val + } +} From 5a2fe9715dd9cafc5888f0b3280c9e269f350447 Mon Sep 17 00:00:00 2001 From: Michael Barz Date: Mon, 16 May 2022 13:35:25 +0200 Subject: [PATCH 2/3] add status route parallel to status.php --- internal/http/services/owncloud/ocdav/ocdav.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/http/services/owncloud/ocdav/ocdav.go b/internal/http/services/owncloud/ocdav/ocdav.go index 140928d799..7f0a8fde82 100644 --- a/internal/http/services/owncloud/ocdav/ocdav.go +++ b/internal/http/services/owncloud/ocdav/ocdav.go @@ -223,7 +223,7 @@ func (s *svc) Close() error { } func (s *svc) Unprotected() []string { - return []string{"/status.php", "/remote.php/dav/public-files/", "/apps/files/", "/index.php/f/", "/index.php/s/"} + return []string{"/status.php", "/status", "/remote.php/dav/public-files/", "/apps/files/", "/index.php/f/", "/index.php/s/"} } func (s *svc) Handler() http.Handler { @@ -248,7 +248,7 @@ func (s *svc) Handler() http.Handler { head, r.URL.Path = router.ShiftPath(r.URL.Path) log.Debug().Str("head", head).Str("tail", r.URL.Path).Msg("http routing") switch head { - case "status.php": + case "status.php", "status": s.doStatus(w, r) return case "remote.php": From a62fee02748af6efe8cad19e9b95f2ef80bd6bae Mon Sep 17 00:00:00 2001 From: Michael Barz Date: Mon, 16 May 2022 13:38:40 +0200 Subject: [PATCH 3/3] add changelog --- changelog/unreleased/version-fixes.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 changelog/unreleased/version-fixes.md diff --git a/changelog/unreleased/version-fixes.md b/changelog/unreleased/version-fixes.md new file mode 100644 index 0000000000..c4a804d5a4 --- /dev/null +++ b/changelog/unreleased/version-fixes.md @@ -0,0 +1,5 @@ +Bugfix: Fix version number in status page + +We needed to undo the version number changes on the status page to keep compatibility for legacy clients. We added a new field `productversion` for the actual version of the product. + +https://github.com/cs3org/reva/pull/2876