saber icon indicating copy to clipboard operation
saber copied to clipboard

Fix #457: force trailing slash in the backend side

Open EslamHiko opened this issue 5 years ago • 5 comments

Summary This PR forcing a redirect to any URL without a trailing slash '/' in the end. This PR is to close : https://github.com/saberland/saber/issues/457

What kind of change does this PR introduce? (check at least one)

  • [x] Bugfix
  • [ ] Feature
  • [ ] Code style update
  • [ ] Refactor
  • [ ] Docs
  • [ ] Build-related changes
  • [ ] Other, please describe:

If changing the UI/CSS related code, please provide the before/after screenshot:

Does this PR introduce a breaking change? (check one)

  • [ ] Yes
  • [x] No

If yes, please describe the impact and migration path for existing applications:

The PR fulfills these requirements:

To avoid wasting your time, it's best to open a feature request issue first and wait for approval before working on it.

Other information:


IssueHunt Summary

Referenced issues

This pull request has been submitted to:


IssueHunt has been backed by the following sponsors. Become a sponsor

EslamHiko avatar Sep 24 '19 14:09 EslamHiko

Deploy preview for saber ready!

Built with commit f583beda95d35ef7356afc0abfd2ccbf4576cee6

https://deploy-preview-470--saber.netlify.com

netlify[bot] avatar Sep 24 '19 14:09 netlify[bot]

This is a demo from my localhost

testgif

I'm not sure why it's not working on netlify, should I place my changes somewhere else?

EslamHiko avatar Sep 24 '19 15:09 EslamHiko

Your change will only apply to our dev server, in production it's built into static HTML files.

egoist avatar Sep 25 '19 07:09 egoist

Would it make more sense that this setting is only applied when the user-specifies what the permalinks are?

For example

# Default values:
permalinks:
  post: /:year/:month/:day/:slug.html
  page: /:slug.html
permalinks:
  post: /:year/:month/:day/:slug
  page: /:slug
permalinks:
  post: /:year/:month/:day/:slug/
  page: /:slug/

Or perhaps it needs to be broken into its own setting?

gavinmcfarland avatar Sep 28 '19 15:09 gavinmcfarland

@limitlessloop I searched a lot I found that it might be achievable by Vue Router: http://jsfiddle.net/L7hscd8h/9377/ we map routes here : https://github.com/saberland/saber/blob/6afe8fa01535900c361e6b23ef70b2aedb9ca055/packages/saber/vue-renderer/app/router.js#L4 and ensure all routes have a trailing slash. and setpathToRegexpOptions: { strict: true } to the routes, will it work?

EslamHiko avatar Sep 29 '19 17:09 EslamHiko