tju-yxq opened a new pull request, #5502:
URL: https://github.com/apache/rocketmq-dashboard/pull/5502
### Which Issue(s) This PR Fixes
- Fixes #5501
### Brief Description
Trims copy-pasted credentials and connection strings at the form boundary —
the backend does no normalization in either flow:
- **CloudCredentialTab**: `accessKey`, `secretKey`, and `name` are trimmed
before `createCloudCredential`/`updateCloudCredential`. The update flow's
blank-secret-means-unchanged semantics (`undefined` → keep the current secret)
are preserved via optional chaining (`values.secretKey?.trim()`).
- **DataSourceTab**: `url` and `name` are trimmed before create/update. The
URL guard (`UrlHostGuard`) strips only its validation copy; the stored value
now feeds `MetricsSourceFactory` without padding.
### How Did You Test This Change?
```
cd web && npm test -- CloudCredentialTab.test.tsx DataSourceTab.test.tsx
--run
Test Files 2 passed (2)
Tests 23 passed (23)
```
The existing suites cover the create/update round-trips including the
blank-secret-on-update path (which initially caught a `''`-vs-`undefined`
regression in this change — fixed by switching to optional chaining). The trim
is additive on the happy path.
```
cd web && npm run lint
✖ 10 problems (0 errors, 10 warnings) # the trunk baseline
```
```
cd web && npx tsc -b --force
(no output — exit 0)
```
### Checklist
- [x] One coherent change; unrelated modifications are not bundled in (one
purpose — trim inputs that authenticate or connect, per the grouping guideline
#2107)
- [x] Commit subject follows Conventional Commits
- [x] Tests added or updated for non-trivial changes (existing round-trip
suites cover the changed paths)
- [x] New UI text has both Chinese and English entries under `web/src/i18n/`
(no new UI text)
- [x] Architecture constraints stay green (`mvn test` runs the ArchUnit
checks) (no Java changes)
- [x] New source files carry the ASF license header (no new source files)
- [ ] Documentation touched where behaviour changed (normalization at the
form boundary)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]