Skip to content

Conversation

@jenul-ferdinand
Copy link

This fixes an issue with the dehyphenateUrl function, which previously only replaces the first hyphen in a string. For URLs with multiple hyphens (e.g., foo-bar-foo), would incorrectly return foo bar-foo.

The fix was to use replaceAll() instead of replace().

Copy link
Contributor

Copilot AI left a 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 fixes a bug in the dehyphenateUrl function where only the first hyphen was being replaced instead of all hyphens. The fix changes replace() to replaceAll() to correctly handle presenter names with multiple hyphens in URL parameters.

  • Updated dehyphenateUrl to use replaceAll() instead of replace() for complete hyphen replacement

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

@@ -1,3 +1,3 @@
export const dehyphenateUrl = (name: string) => {
return name.replace("-", " ");
return name.replaceAll("-", " ");
Copy link

Copilot AI Nov 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix for dehyphenateUrl should include test coverage to verify that all hyphens are replaced correctly. Consider adding tests that cover:

  • Single hyphen: "foo-bar""foo bar"
  • Multiple hyphens: "foo-bar-baz""foo bar baz"
  • No hyphens: "foobar""foobar"
  • Edge cases: empty string, string with only hyphens, etc.

This would prevent regression of the original bug where only the first hyphen was replaced.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant