Skip to content

Trailingslash has a wrong ranking and creates empty params in array if after a wildcard parameter #2379

@Tofandel

Description

@Tofandel

Reproduction

https://play.vuejs.org/#eNqtVV1P2zAU/SteNqnt1tqlQzxkoWNDaGzaB2LTXpY9pImbBhLbsh0oivrfd22niQsFXibUNrn33ONzfY9NE1RJwfCVCsKgqASXGjUolTTR9IMQaIOWkldocFPTQcw6gOS1prLLYuICPcTUbnOJENjVx6xjHsJnFDOEcK3o0JW794rXTA8HL6FsMArGQVsO+iJNK1FC/dwAo9XB/JyWJTeLvYgIvNqwsD/woLTkLJ+f1lJSpp1mJBK9CiPS5lDToFc2gZd1WV5AEm02loY4noglN1vCS6vya8GukebHcUDiYP6JwzM65xWNSJ9/tCJZpCSjy75SU6WfqQxtacOSioZoYAomIsnpYAzNyKRSIWowxq4LFzGZHMAz6MVfCN0W0KDJPVgyIttGI2OIXRm/C3qLSItr0xHxpgGvKpWF0EhRXZud66wC47UkvpUmrV3egSE4A11uNscdeDiCFEzJcs7BBK4A6z02/UYrLu/OC6XhZ9wGne59axqxLYOZmm1t69RtoLXr1ssLqNzBdZHO13RtoV43EtrxtQwbs30rJzPcp304GhuIrYah/nEjaJxl0YDAwFMOkhi4OezFb2yVAXoOseZwZaF5H+LX70ev71H0je3l6F32kMikSGi+h3GcvRk9w/wXvjdwvGGS/h6bM+37BpUJy8HrWoFtPQNYg907/LP5lgmO/mzXkLDMzoieWed/enW/1E5NqxV2uvEPrLlzdvU7TZMqEXA3cwYdWP/EbQKEw7F3Q4uDXqYJx8FKa6FCQmomrnMMcyE94uQQv8VTkoHnvCimqposJL9V8HwF7K0h4uAEQHBl3WjOSzVJRPHYEg+AJ0f4CB+QslgQYCcFy+jachtqaHgDbWoFm7os8ntNGisVJZU/hC5g03eaTeDKv/1iY1rWtBOarmh6vSd+pdZO8oWk0N0N9ZrTicypdumzn9/pGp67ZMWzugT0E8lLqnhZG40O9rFmGcj2cFbtZzuzguW/1NlaU6a2TRmhdjcs3g7y9InWe7lv8aG3i0rflVThVJnrEe7xMTKXtKtbcJlRCf8LxBqB2CJDL6fTKVgWAUjmBZssuNa8CtHBVKxtXCRZBmK7CKwSM6BFc5SgN/CxxG11SZdw4H3kauav3NP3AtI09QSEaAp/s5Yh2PwD2IzlHA==

Steps to reproduce the bug

  1. Click on "Go to test"
  2. Notice the route.params is an array with an empty element at the end
  3. Click on "Go to test with page", notice the page has now 2 slashes in it

Expected behavior

Without a trailing slash the ranking is correct, I think the trailingslash should have a lower rank than a regex
https://paths.esm.dev/?p=AAMeJUyB3A7ACAROgDYMTAHuJXIFqHQAUAFACTg_OQA5INikft_qADWgAQVDQMk8w6RBgNwSAIA.&t=/en/brands/abcd/efh/page/2#

Actual behavior

With a trailing slash now the ranking is wrong and the second route can never be matched https://paths.esm.dev/?p=AAMeJUyB3A7ACAROgDYMTAHuJXIFqHQAUAFACTg_OQA5INikft_qADWg4AUBBfMMSSMghySCcrsAAA..&t=/en/brands/abcd/efh/page/2#

Additional information

I think the trailingslash should be discarded from the params list because it's in any case optional with vue router

The ranking should also be changed so that a trailingslash doesn't alter the ranking

Related #1300
#1123

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions