Skip to content

Conversation

touletan
Copy link
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

  • My code follows the code style of this project.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • My change requires a documentation update, and I've opened a pull request to update it already:
  • I have read https://mithril.js.org/contributing.html.

@touletan touletan requested a review from a team as a code owner May 23, 2025 02:40
Copy link
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.)

@@ -225,6 +225,30 @@ o.spec("route", function() {
)
})

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
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