Skip to content

Commit

Permalink
Merge pull request #2876 from micbar/fix-version
Browse files Browse the repository at this point in the history
Fix version
  • Loading branch information
micbar authored May 17, 2022
2 parents 40a910e + a62fee0 commit 690fb7f
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 2 deletions.
5 changes: 5 additions & 0 deletions changelog/unreleased/version-fixes.md
Original file line number Diff line number Diff line change
@@ -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
9 changes: 7 additions & 2 deletions internal/http/services/owncloud/ocdav/ocdav.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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"
}
Expand Down Expand Up @@ -218,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 {
Expand All @@ -243,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":
Expand Down
1 change: 1 addition & 0 deletions internal/http/services/owncloud/ocdav/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}

Expand Down
1 change: 1 addition & 0 deletions internal/http/services/owncloud/ocs/data/capabilities.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}

Expand Down
7 changes: 7 additions & 0 deletions pkg/micro/ocdav/option.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

0 comments on commit 690fb7f

Please sign in to comment.