fix: trim trailing hyphens from truncated usernames #15
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/username-double-hyphen"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
When deriveUsername truncates at 31 chars it can end on a hyphen,
producing a double-hyphen when the hash suffix is appended (e.g.
auto-admin-brooktrails-forgejo--f1cad0ee). Forgejo rejects these
as invalid usernames.
Co-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com
Automated review by pr-reviewer v0.15.0 | Safety Check | anthropic | tracking id
r-c5a198-ceddd5This is an AI-genrated review and may contain mistakes.
Status: ✅ Completed
✅ Verdict: LGTM — Clean fix that prevents double-hyphens in usernames by trimming trailing hyphens before appending the hash suffix.
Complexity: trivial
This is a straightforward bug fix that addresses username validation issues in Forgejo. The change prevents double-hyphens (e.g.,
--) from appearing in generated usernames by trimming trailing hyphens from the truncated portion before appending the hash suffix. The fix is minimal and targeted - no security concerns or breaking changes identified.a28a7ada7fd97817769eAutomated review by pr-reviewer v0.15.0 | Safety Check | anthropic | tracking id
r-c5a1a1-cb3fbbThis is an AI-generated review and may contain mistakes.
Status: ✅ Completed
✅ Verdict: LGTM — The fix correctly prevents double-hyphens in usernames by trimming trailing hyphens before appending the hash suffix.
Complexity: trivial
Safety Check Review
The change fixes a bug where truncated usernames ending with a hyphen would create invalid double-hyphen usernames when the hash suffix is appended. The fix is straightforward - using
strings.TrimRight(name[:31], "-")to remove trailing hyphens before appending the-and hash suffix.No security issues or breaking changes identified. The logic is sound and addresses the described problem.