Skip to content

fix(graph): reject empty and invisible drive names on update - #3946

Merged
butonic merged 1 commit into
opencloud-eu:workpagagesfrom
pbleser-oc:fix/graph-reject-empty-drive-name
Nov 11, 2026
Merged

butonic merged 1 commit into
opencloud-eu:workpagagesfrom
pbleser-oc:fix/graph-reject-empty-drive-name

Conversation

@pbleser-oc

Copy link
Copy Markdown
Member

Updating a drive with "name": "" succeeded and silently kept the old name, because the name was only validated when it was non-empty. It is now validated whenever the request contains it, so an empty name gets 400, as on create. A request without a name, or with "name": null, still leaves the name unchanged.

Space names were trimmed with strings.TrimSpace, which only removes Unicode whitespace. Invisible formatting characters such as the zero-width space (U+200B), the word joiner (U+2060) or the byte order mark (U+FEFF) aren't whitespace, so a name made only of them was accepted on create and on update, and showed up as an empty name in clients. They are now trimmed from both ends of the name as well. Inside a name they are still allowed, e.g. the zero-width joiner in emoji sequences.

Tests

  • Unit tests for the trimming helper and for the update handler: rejected names and names left unchanged.
  • A new Behat step that takes the name as JSON escape sequences, so invisible characters stay readable in feature files, plus scenarios in changeSpaces.feature. They pass on posix and decomposed.

AI assistance: Claude Code (claude-opus-5-5) wrote the first draft of the code and the tests; the change was reviewed by the author.

Updating a drive with an empty name ("name": "") succeeded and silently
kept the old name, because the name was only validated when it was
non-empty. Validate it whenever the request contains it, so an empty
name is rejected with 400 like on create. A request without a name, or
with "name": null, still leaves the name unchanged.

Space names were trimmed with strings.TrimSpace, which only removes
Unicode whitespace. Invisible formatting characters such as the
zero-width space (U+200B), the word joiner (U+2060) or the byte order
mark (U+FEFF) aren't whitespace, so a name made only of them was
accepted on create and on update, and showed up as an empty name in
every client. Trim these characters from both ends of the name as
well. Inside a name they are still allowed, since some of them are
needed there, e.g. the zero-width joiner in emoji sequences.

Assisted-by: Claude Code:claude-opus-5-5
@codacy-production

codacy-production Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 5 complexity

Metric Results
Complexity 5

View in Codacy

🟢 Coverage 100.00% diff coverage · +0.02% coverage variation

Metric Results
Coverage variation ✅ +0.02% coverage variation (-1.00%)
Diff coverage ✅ 100.00% diff coverage

View coverage diff in Codacy

Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (83615f2) Report Missing Report Missing Report Missing
Head commit (0e26528) 92644 (+4) 25440 (+22) 27.46% (+0.02%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#3946) 7 7 100.00%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

1 Codacy didn't receive coverage data for the commit, or there was an error processing the received data. Check your integration for errors and validate that your coverage setup is correct.

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@butonic
butonic merged commit 9c7ecc1 into opencloud-eu:workpagages Nov 11, 2026
65 checks passed
@pbleser-oc
pbleser-oc deleted the fix/graph-reject-empty-drive-name branch November 12, 2026 08:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants