laravel / folio

Page based routing for Laravel.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't generate url route which starts with "/index"

ext4nt opened this issue · comments

Folio Version

1.1.5

Laravel Version

10.43

PHP Version

8.2

Description

Hello,
Thanks for the great job. Laravel Folio is really cool thing.

I have some categories and pages on my website, which have url path like:
domain.com/carrier/indexed/safe-return OR domain.com/carrier/fixed/index-protector-7

So the problem is that Folio is replacing all "/index" and "/index/" strings in the whole url if route() function was used to generate url. And result will be:
domain.com/carrier/ed/safe-return OR domain.com/carrier/fixed-protector-7

As you may understand, all "/index" were removed from URL, so I can't generate url correctly using route() function. If copy/paste full url to browser or generate it in another way, it works.

I found it's happening in FolioRoutes.php class.

image

Any chance it can be fixed somehow? Got a lot of pages with a slugs like "some-page/index-some-name".

Steps To Reproduce

Create strtucture like:

image

Try to generate url using route() function.

Url for /indexed/ folder will not be generated correctly.

Second problem, create any model and give slug like "index-protector-7" and try to make a url like domain.com/index-protector-7 using route() function. Part "/index" will be removed from url.

image

Thank you for reporting this issue!

As Laravel is an open source project, we rely on the community to help us diagnose and fix issues as it is not possible to research and fix every issue reported to us via GitHub.

If possible, please make a pull request fixing the issue you have described, along with corresponding tests. All pull requests are promptly reviewed by the Laravel team.

Thank you!

Thanks for your report. I agree this can be done better, probably through a regex. We'd welcine a PR for this.