Skip to content

set trailing slash optional in route matching#3025

Merged
dead-claudia merged 2 commits into
MithrilJS:mainfrom
touletan:issue-3024-fix-trailing-slash
May 27, 2025
Merged

set trailing slash optional in route matching#3025
dead-claudia merged 2 commits into
MithrilJS:mainfrom
touletan:issue-3024-fix-trailing-slash

Conversation

@touletan
Copy link
Copy Markdown
Contributor

@touletan touletan commented May 23, 2025

Description

Regexp has been updated to set trailing slash as optional in route matching.

Motivation and Context

link to issue 3024.

How Has This Been Tested?

New test has been added. The previous change to keep trailing slash when it match with rest operator is still working.
This is removing the previoous breaking change of always keeping the trailing slash.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

@touletan touletan requested a review from a team as a code owner May 23, 2025 02:40
Copy link
Copy Markdown
Member

@dead-claudia dead-claudia left a comment

Choose a reason for hiding this comment

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

Looks good to me aside from that nit. I'll turn this into an approval once the suggestion is merged. (I'll try it on my end first.)

Comment thread api/tests/test-router.js Outdated

o("remove trailing slash to match route if it is before rest operator match (...) ", function() {
$window.location.href = prefix + "/test/d/"
route(root, "/test/:a...", {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This isn't a default template, but a default route path. Did you mean to put something else here?

Also, sorry for the delay in reviewing this.

Suggested change
route(root, "/test/:a...", {
route(root, "/test/some/path", {

Signed-off-by: Claudia Meadows <[email protected]>
@dead-claudia dead-claudia merged commit 55a297c into MithrilJS:main May 27, 2025
7 checks passed
@JAForbes JAForbes mentioned this pull request May 27, 2025
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.

2 participants