From 0b6bd5ee68cd2c2bb03250f7507b5b307e3e05c4 Mon Sep 17 00:00:00 2001 From: Roman Perekhod <2403905@gmail.com> Date: Tue, 20 Jan 2026 19:44:54 +0100 Subject: [PATCH] fix: fix the error handling for empty name on space update --- changelog/unreleased/fix-space-error-code-upd.md | 6 ++++++ services/graph/pkg/service/v0/drives.go | 2 +- .../expected-failures-localAPI-on-OCIS-storage.md | 3 --- 3 files changed, 7 insertions(+), 4 deletions(-) create mode 100644 changelog/unreleased/fix-space-error-code-upd.md diff --git a/changelog/unreleased/fix-space-error-code-upd.md b/changelog/unreleased/fix-space-error-code-upd.md new file mode 100644 index 00000000000..3705118fc1b --- /dev/null +++ b/changelog/unreleased/fix-space-error-code-upd.md @@ -0,0 +1,6 @@ +Bugfix: Fix the error handling for empty name on space update + +Fix the error handling for empty name on space update. + +https://github.com/owncloud/ocis/pull/11933 +https://github.com/owncloud/ocis/issues/11887 \ No newline at end of file diff --git a/services/graph/pkg/service/v0/drives.go b/services/graph/pkg/service/v0/drives.go index 29c61bd2958..c4657b32054 100644 --- a/services/graph/pkg/service/v0/drives.go +++ b/services/graph/pkg/service/v0/drives.go @@ -574,7 +574,7 @@ func (g Graph) updateDrive(w http.ResponseWriter, r *http.Request, apiVersion AP } } - if drive.GetName() != "" { + if _, ok := drive.GetNameOk(); ok { spacename := strings.TrimSpace(drive.GetName()) if err := validateSpaceName(spacename); err != nil { logger.Info().Err(err).Msg("could not update drive: spacename invalid") diff --git a/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md b/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md index 533bd6c9ee3..0eb14a398cd 100644 --- a/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md +++ b/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md @@ -401,9 +401,6 @@ The expected failures in this file are from features in the owncloud/ocis repo. - [apiGraphUser/getUser.feature:696](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraphUser/getUser.feature#L696) - [apiGraphUser/getUser.feature:700](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraphUser/getUser.feature#L700) -#### [PATCH /v1.0/drives/{drive-id} accepts empty name](https://github.com/owncloud/ocis/issues/11887) - -- [apiSpaces/changeSpaces.feature:603](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpaces/changeSpaces.feature#L603) Note: always have an empty line at the end of this file. The bash script that processes this file requires that the last line has a newline on the end.