diff --git a/go.mod b/go.mod index fe8e2fae4e..3de9e39ca7 100644 --- a/go.mod +++ b/go.mod @@ -54,7 +54,7 @@ require ( github.com/onsi/ginkgo/v2 v2.5.0 github.com/onsi/gomega v1.24.1 github.com/orcaman/concurrent-map v1.0.0 - github.com/owncloud/libre-graph-api-go v1.0.1-0.20221216081114-57ab57ed98b0 + github.com/owncloud/libre-graph-api-go v1.0.1-0.20221220084037-8c6f7ea26400 github.com/pkg/errors v0.9.1 github.com/prometheus/client_golang v1.14.0 github.com/rs/zerolog v1.28.0 diff --git a/go.sum b/go.sum index 211fe21960..42b0f4e452 100644 --- a/go.sum +++ b/go.sum @@ -343,8 +343,6 @@ github.com/crewjam/saml v0.4.6 h1:XCUFPkQSJLvzyl4cW9OvpWUbRf0gE7VUpU8ZnilbeM4= github.com/crewjam/saml v0.4.6/go.mod h1:ZBOXnNPFzB3CgOkRm7Nd6IVdkG+l/wF+0ZXLqD96t1A= github.com/cs3org/go-cs3apis v0.0.0-20221012090518-ef2996678965 h1:y4n2j68LLnvac+zw/al8MfPgO5aQiIwLmHM/JzYN8AM= github.com/cs3org/go-cs3apis v0.0.0-20221012090518-ef2996678965/go.mod h1:UXha4TguuB52H14EMoSsCqDj7k8a/t7g4gVP+bgY5LY= -github.com/cs3org/reva/v2 v2.12.1-0.20221219152307-4d5800e63bf4 h1:FxPCpd3oE5snNw5filxKGd3M27ySbjqeiiMTBJI8tSw= -github.com/cs3org/reva/v2 v2.12.1-0.20221219152307-4d5800e63bf4/go.mod h1:GpocVB1w6yxeSr1VBsO9jztmt1SyNC4lCwudLwDzxHQ= github.com/cs3org/reva/v2 v2.12.1-0.20221223093348-3ae37de4759d h1:8CzNOyGaqIDv3rlYGYxv8TIYVHPBLkPmyTprlOh1Om4= github.com/cs3org/reva/v2 v2.12.1-0.20221223093348-3ae37de4759d/go.mod h1:GpocVB1w6yxeSr1VBsO9jztmt1SyNC4lCwudLwDzxHQ= github.com/cubewise-code/go-mime v0.0.0-20200519001935-8c5762b177d8 h1:Z9lwXumT5ACSmJ7WGnFl+OMLLjpz5uR2fyz7dC255FI= @@ -1057,8 +1055,8 @@ github.com/oracle/oci-go-sdk v24.3.0+incompatible/go.mod h1:VQb79nF8Z2cwLkLS35uk github.com/orcaman/concurrent-map v1.0.0 h1:I/2A2XPCb4IuQWcQhBhSwGfiuybl/J0ev9HDbW65HOY= github.com/orcaman/concurrent-map v1.0.0/go.mod h1:Lu3tH6HLW3feq74c2GC+jIMS/K2CFcDWnWD9XkenwhI= github.com/ovh/go-ovh v1.1.0/go.mod h1:AxitLZ5HBRPyUd+Zl60Ajaag+rNTdVXWIkzfrVuTXWA= -github.com/owncloud/libre-graph-api-go v1.0.1-0.20221216081114-57ab57ed98b0 h1:47N8o/5MmQ5781dF44fk1lQtyFmTAvu6/5hPG3rM1TQ= -github.com/owncloud/libre-graph-api-go v1.0.1-0.20221216081114-57ab57ed98b0/go.mod h1:579sFrPP7aP24LZXGPopLfvE+hAka/2DYHk0+Ij+w+U= +github.com/owncloud/libre-graph-api-go v1.0.1-0.20221220084037-8c6f7ea26400 h1:E8+qYjS2P21dE4gGVep0JAqPleL74wugwnXSHKAoDp4= +github.com/owncloud/libre-graph-api-go v1.0.1-0.20221220084037-8c6f7ea26400/go.mod h1:579sFrPP7aP24LZXGPopLfvE+hAka/2DYHk0+Ij+w+U= github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c h1:rp5dCmg/yLR3mgFuSOe4oEnDDmGLROTvMragMUXpTQw= github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c/go.mod h1:X07ZCGwUbLaax7L0S3Tw4hpejzu63ZrrQiUe6W0hcy0= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= diff --git a/services/graph/pkg/service/v0/drives.go b/services/graph/pkg/service/v0/drives.go index b03242c1fe..fc631a3d05 100644 --- a/services/graph/pkg/service/v0/drives.go +++ b/services/graph/pkg/service/v0/drives.go @@ -248,7 +248,7 @@ func (g Graph) CreateDrive(w http.ResponseWriter, r *http.Request) { errorcode.InvalidRequest.Render(w, r, http.StatusBadRequest, "invalid body schema definition") return } - spaceName := strings.TrimSpace(*drive.Name) + spaceName := strings.TrimSpace(drive.Name) if err := validateSpaceName(spaceName); err != nil { logger.Debug().Str("name", spaceName).Err(err).Msg("could not create drive: name validation failed") errorcode.InvalidRequest.Render(w, r, http.StatusBadRequest, fmt.Sprintf("invalid spacename: %s", err.Error())) @@ -392,8 +392,8 @@ func (g Graph) UpdateDrive(w http.ResponseWriter, r *http.Request) { } } - if drive.Name != nil { - spacename := strings.TrimSpace(*drive.Name) + if drive.Name != "" { + spacename := strings.TrimSpace(drive.Name) if err := validateSpaceName(spacename); err != nil { logger.Info().Err(err).Msg("could not update drive: spacename invalid") errorcode.GeneralException.Render(w, r, http.StatusBadRequest, err.Error()) @@ -599,7 +599,7 @@ func (g Graph) cs3StorageSpaceToDrive(ctx context.Context, baseURL *url.URL, spa drive := &libregraph.Drive{ Id: libregraph.PtrString(spaceID), - Name: &space.Name, + Name: space.Name, //"createdDateTime": "string (timestamp)", // TODO read from StorageSpace ... needs Opaque for now DriveType: &space.SpaceType, Root: &libregraph.DriveItem{ diff --git a/services/graph/pkg/service/v0/ordering.go b/services/graph/pkg/service/v0/ordering.go index f3464619fc..b636e4dacf 100644 --- a/services/graph/pkg/service/v0/ordering.go +++ b/services/graph/pkg/service/v0/ordering.go @@ -24,7 +24,7 @@ type spacesByLastModifiedDateTime struct { // Less reports whether the element with index i // must sort before the element with index j. func (s spacesByName) Less(i, j int) bool { - return strings.ToLower(*s.spacesSlice[i].Name) < strings.ToLower(*s.spacesSlice[j].Name) + return strings.ToLower(s.spacesSlice[i].Name) < strings.ToLower(s.spacesSlice[j].Name) } // Less reports whether the element with index i @@ -43,7 +43,7 @@ func (s spacesByLastModifiedDateTime) Less(i, j int) bool { return false } // fallback to name if no dateTime is set on both items - return strings.ToLower(*s.spacesSlice[i].Name) < strings.ToLower(*s.spacesSlice[j].Name) + return strings.ToLower(s.spacesSlice[i].Name) < strings.ToLower(s.spacesSlice[j].Name) } type userSlice []*libregraph.User diff --git a/services/graph/pkg/service/v0/password.go b/services/graph/pkg/service/v0/password.go index 854372a9a2..66c82ffccd 100644 --- a/services/graph/pkg/service/v0/password.go +++ b/services/graph/pkg/service/v0/password.go @@ -33,7 +33,7 @@ func (g Graph) ChangeOwnPassword(w http.ResponseWriter, r *http.Request) { errorcode.InvalidRequest.Render(w, r, http.StatusBadRequest, err.Error()) return } - cpw := libregraph.NewPasswordChange() + cpw := libregraph.NewPasswordChangeWithDefaults() err = json.NewDecoder(r.Body).Decode(cpw) if err != nil { errorcode.InvalidRequest.Render(w, r, http.StatusBadRequest, err.Error())