Skip to content

fix(files_sharing): limit the share token input to the maximum token length#61826

Open
MiMoHo wants to merge 2 commits into
nextcloud:masterfrom
MiMoHo:fix/61416/token-input-maxlength
Open

fix(files_sharing): limit the share token input to the maximum token length#61826
MiMoHo wants to merge 2 commits into
nextcloud:masterfrom
MiMoHo:fix/61416/token-input-maxlength

Conversation

@MiMoHo

@MiMoHo MiMoHo commented Jul 5, 2026

Copy link
Copy Markdown

Summary

The custom share link token input accepts arbitrarily long values, while the server (and the oc_share.token database column) only allows 32 characters. Before #61630 this failed at the database layer with a generic "Failed to update share."; since #61630 the server returns a descriptive validation message — but in both cases users only learn about the limit after submitting the form.

This communicates the constraint up front:

  • maxlength on the token input, matching ShareAPIController::TOKEN_MAX_LENGTH (32), so the input simply cannot exceed the limit, and
  • the helper text now mentions the length and character constraints.

token field with maxlength and updated helper text

Testing

Verified against a local instance (Playwright):

  • the rendered input carries maxlength="32",
  • typing 40 characters stops at 32,
  • the helper text mentions the limit,
  • saving afterwards succeeds ("Share saved").

Related: #61416 — follow-up to #61630 (server-side validation).

🤖 Generated with Claude Code

MiMoHo and others added 2 commits July 5, 2026 02:06
…length

The custom share link token input accepted arbitrarily long values,
while the server (and the oc_share.token database column) only allows
32 characters. Users learned about the limit only after submitting the
form and reading the error toast.

Set the maxlength attribute on the token input matching
ShareAPIController::TOKEN_MAX_LENGTH and mention the length and
character constraints in the helper text, so the limit is communicated
before saving instead of after a failed request.

Related: nextcloud#61416, follow-up to nextcloud#61630

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: MiMoHo <37556964+MiMoHo@users.noreply.github.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: MiMoHo <37556964+MiMoHo@users.noreply.github.com>
@MiMoHo MiMoHo requested a review from a team as a code owner July 5, 2026 00:07
@MiMoHo MiMoHo requested review from nfebe, skjnldsv and susnux and removed request for a team July 5, 2026 00:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant