Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: don't add trailing slashes to generated routes #733

Merged
merged 1 commit into from
May 27, 2020
Merged

Conversation

rchl
Copy link
Collaborator

@rchl rchl commented May 25, 2020

Module was adding a trailing slash for extra routes that
it was generating.

This isn't normally a problem as VueRouter runs by default in
non-strict mode and normalizes paths to not have trailing slashes but
when the "router.trailingSlash = false" option was set in Nuxt, then
the matching was strict and actually made trailing slashes appear in
the path.

Follow the same logic as Nuxt and:

  • don't add trailing slashes by default or when "router.trailingSlash"
    option is set to "false"
  • add trailing slashes when "router.trailingSlash" option is set
    to "true"

Resolves #717

Module was adding a trailing slash for extra routes that
it was generating.

This isn't normally a problem as VueRouter runs by default in
non-strict mode and normalizes paths to not have trailing slashes but
when the "router.trailingSlash = false" option was set in Nuxt, then
the matching was strict and actually made trailing slashes appear in
the path.

Follow the same logic as Nuxt and:
 - don't add trailing slashes by default or when "router.trailingSlash"
   option is set to "false"
 - add trailing slashes when "router.trailingSlash" option is set
   to "true"

Resolves #717
@codecov
Copy link

codecov bot commented May 26, 2020

Codecov Report

Merging #733 into master will increase coverage by 0.07%.
The diff coverage is 85.71%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #733      +/-   ##
==========================================
+ Coverage   97.60%   97.67%   +0.07%     
==========================================
  Files           3        3              
  Lines         125      129       +4     
  Branches       33       35       +2     
==========================================
+ Hits          122      126       +4     
  Misses          3        3              
Impacted Files Coverage Δ
src/helpers/routes.js 96.77% <83.33%> (+0.16%) ⬆️
src/index.js 97.87% <100.00%> (+0.04%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 09d2c0f...4825d61. Read the comment docs.

@rchl rchl merged commit b062044 into master May 27, 2020
@rchl rchl deleted the fix/trailing-slash branch May 27, 2020 11:03
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.

trailingSlash option in router does impact i18n root page
1 participant