Skip to content

Conversation

@tomgobich
Copy link
Contributor

Proposed changes

Fixes v6 issue 48, by stripping slashes prior to adding uriSegment within proccessPattern.

Changes this:

if (token.type === 0) {
  uriSegments.push(`${token.val}${token.end}`)
}

To this:

if (token.type === 0) {
  const value = token.val.startsWith('/') ? token.val.substring(1) : token.val
  uriSegments.push(`${value}${token.end}`)
}

Added two new tests as well to cover this noted issue within tests/router/url_builder.spec.ts:

  • create url for a route by its name for the home path
  • create url for a route by the handler name for the home path

Types of changes

What types of changes does your code introduce?

  • Bugfix (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 not work as expected)

Checklist

  • I have read the CONTRIBUTING doc
  • Lint and unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added necessary documentation (if appropriate)

Further comments

Doesn't look like npm commit exists yet in the next branch, so I went ahead and just used git commit. If you need anything changed, just let me know 😊

@thetutlage
Copy link
Member

Sorry, took a while as I was focusing on other stuff. Lemme merge it and then give it a run locally.

Thanks for taking out time

@thetutlage thetutlage merged commit a0e8f15 into adonisjs:next Nov 22, 2023
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