-
Notifications
You must be signed in to change notification settings - Fork 25
fix: check byte length on name validation instead of character count #1187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR changes resource name validation from checking character count to checking byte length, addressing issues with multi-byte Unicode characters that could cause validation to pass but fail at the backend level.
- Updates validation logic to use
TextEncoderfor accurate byte length calculation - Increases the maximum allowed bytes from 63 characters to 256 bytes
- Simplifies error messages to be more generic
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| packages/web-pkg/src/constants.ts | Adds new RESOURCE_NAME_MAX_BYTES constant (256) |
| packages/web-pkg/src/composables/actions/helpers/useIsResourceNameValid.ts | Replaces character length validation with byte length validation using TextEncoder |
| packages/web-pkg/tests/unit/composables/actions/helpers/useIsResourceNameValid.spec.ts | Updates test cases to use new byte-based validation and simplified error messages |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
packages/web-pkg/src/composables/actions/helpers/useIsResourceNameValid.ts
Outdated
Show resolved
Hide resolved
packages/web-pkg/src/composables/actions/helpers/useIsResourceNameValid.ts
Outdated
Show resolved
Hide resolved
packages/web-pkg/src/composables/actions/helpers/useIsResourceNameValid.ts
Outdated
Show resolved
Hide resolved
packages/web-pkg/src/composables/actions/helpers/useIsResourceNameValid.ts
Outdated
Show resolved
Hide resolved
35b2438 to
57225f1
Compare
kulmann
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Super nice improvement 🥇
Description
Related Issue
How Has This Been Tested?
Types of changes