Repository navigation
feat(tags): trim tags and add validation before adding them - #1005
Merged
pbleser-oc merged 2 commits intoNov 16, 2026
Merged
Conversation
Tags are now normalized before they are added or removed: whitespace around each tag is removed and empty tags are dropped, so " work" and "work" are the same tag, and a list such as "a, ,b" no longer stores an empty tag. This covers all Unicode whitespace, and also the invisible zero-width space, word joiner and zero-width no-break space, which would otherwise make a tag look exactly like another one. AddValidated works like Add, but passes the normalized tags to a validator first and adds nothing if it returns an error. MaxLengthValidator returns such a validator that rejects tags longer than a given number of characters (counted in Unicode code points) and tags that are not valid UTF-8, and lists all offending tags in its error. The new graph capability tags.max_tag_length lets clients know the limit before they send a tag. Assisted-by: Claude Code:claude-opus-5-5
asaah262
reviewed
Nov 16, 2026
The graph tags capability is always sent, so a server that doesn't set the limit reports 0. Say in the doc comment that 0 means no limit, so that clients don't reject every tag. Assisted-by: Claude Code:claude-opus-5-5
asaah262
approved these changes
Nov 16, 2026
asaah262
left a comment
There was a problem hiding this comment.
Thanks. Just left one small, non-blocking question.
pbleser-oc
added a commit
to pbleser-oc/opencloud
that referenced
this pull request
Nov 16, 2026
Brings in the tag normalization and length validation of opencloud-eu/reva#1005 (tags.AddValidated, tags.MaxLengthValidator, the graph.tags capability). The only other change since 036856689 is the backport configuration of the reva repository. Assisted-by: Claude Code:claude-opus-5-5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tags are now trimmed before they are added or removed, and a new
AddValidatedlets callers check tags, e.g. their length, before they are stored. A new graph capabilitytags.max_tag_lengthtells clients the limit.Changes
pkg/tags):New,AddandRemovesplit the input on the separator, trim whitespace around each tag and drop empty tags." work"and"work"are now the same tag, and"a, ,b"no longer stores an empty tag.AddValidated(validator, tags...)works likeAdd, but first passes the normalized tags tovalidatorand adds nothing if it returns an error.MaxLengthValidator(maxTagLength)returns a validator that rejects tags longer thanmaxTagLengthcharacters (Unicode code points, not bytes) and tags that aren't valid UTF-8. Its error lists all offending tags. A limit of 0 or less means no limit.CapabilitiesGraphgetsTagswithMaxTagLength(graph.tags.max_tag_length), so clients can check the length before sending a tag.Behaviour change
Because of the trimming,
Add,Removeand the stored tags change for tags with surrounding whitespace:" work"before is now found and removed by"work"."work "when"work"exists is no longer a new tag.In opencloud,
pkg/tagsis used by graph (tag assignment) and by search and webdav. They pick this up with the reva bump. Their tests pass with this branch: graph, search and webdav, built against it with ago.work.Follow-up
The opencloud PR that bumps reva will use
AddValidatedwithMaxLengthValidatorwhen tags are assigned (400 on overlong tags), make the limit configurable, and set the capability.AI assistance: Claude Code (claude-opus-5-5) wrote the code and the tests, and the first draft of this description; I reviewed them.