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
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
@susnux susnux added the community pull requests from community label Jul 6, 2026
MiMoHo added 2 commits July 6, 2026 18:59
…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>
Assisted-by: ClaudeCode:claude-fable-5
Signed-off-by: MiMoHo <37556964+MiMoHo@users.noreply.github.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Assisted-by: ClaudeCode:claude-fable-5
Signed-off-by: MiMoHo <37556964+MiMoHo@users.noreply.github.com>
@MiMoHo
MiMoHo force-pushed the fix/61416/token-input-maxlength branch from a1a9f35 to d4c832c Compare July 6, 2026 17:31
@github-actions

Copy link
Copy Markdown
Contributor

Hello there,
Thank you so much for taking the time and effort to create a pull request to our Nextcloud project.

We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process.

Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6

Thank you for contributing to Nextcloud and we hope to hear from you soon!

(If you believe you should not receive this message, you can add yourself to the blocklist.)

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.

3 participants