apply: re-strip trailing hyphen after slice so slugify is idempotent#3
Open
devin-ai-integration[bot] wants to merge 1 commit into
Open
apply: re-strip trailing hyphen after slice so slugify is idempotent#3devin-ai-integration[bot] wants to merge 1 commit into
devin-ai-integration[bot] wants to merge 1 commit into
Conversation
Devin Review #BUG_..._0001: when an input long enough to hit the 32-char cap landed with a hyphen at character 32, .slice(0, 32) reintroduced the trailing hyphen the prior .replace(/^-+|-+$/g, '') had stripped. That made slugify non-idempotent — slugify(slugify(x)) != slugify(x) — which silently broke the state.slug === slugify(state.slug) advance check on the slug step and showed a misleading 'invalid characters' error. One-line fix: re-strip a trailing hyphen after the slice.
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
devin-ai-integration Bot
added a commit
that referenced
this pull request
Apr 30, 2026
…out resolveNext Mirrors sof-ai-repo PR #55 follow-up. WHATWG URL parser normalises backslashes to forward slashes for http/https, so '/\\evil.com' resolves to 'https://evil.com/' — open redirect via Location header. Co-Authored-By: Dr. Freedom Cheteni <freedom@thevrschool.org>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Devin Review caught a real edge case in
slugifyoncomponents/sections/apply-form.tsx—.slice(0, 32)runs after.replace(/^-+|-+$/g, ""), so when the 32-char cap landed on a hyphen the truncation reintroduced the trailing hyphen the prior strip had removed.That made
slugifynon-idempotent:slugify(slugify(x))could differ fromslugify(x). The form's advance check on the slug step isstate.slug === slugify(state.slug)(the input value is alreadyslugify(raw)because ofonChange={(e) => update("slug", slugify(e.target.value))}), so the user's slug fails the round-trip and the form blocks them — with a misleading "Slug must be lowercase letters, numbers, and hyphens only" error.Repro: type
"abcdefghijklmnopqrstuvwxyz12345 xy"into the slug field. Without this PR it gets stored as"abcdefghijklmnopqrstuvwxyz12345-"(32 chars, trailing hyphen) and the Continue button stays disabled with the wrong error.Fix is one line: re-strip a trailing hyphen after the slice cap.
Review & Testing Checklist for Human
/applyform, get to the slug step, paste a long name with a space at character 31 (e.g."abcdefghijklmnopqrstuvwxyz12345 xy"), confirm the slug ends without a trailing-and the Continue button enables."Ada Lovelace"→"ada-lovelace") still slugify correctly.Notes
pnpm build).Link to Devin session: https://app.devin.ai/sessions/091fc09f81b5489292102ebcdc173dbb
Requested by: @DearMrFree