Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
Commitc14d0a1
committed
bug#46097 [Routing] fix router base url when default uri has trailing slash (Tobion)
This PR was merged into the 5.4 branch.Discussion----------[Routing] fix router base url when default uri has trailing slash| Q | A| ------------- | ---| Branch? | 5.4| Bug fix? | yes| New feature? | no <!-- please update src/**/CHANGELOG.md files -->| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->| Tickets || License | MIT| Doc PR |When the router default uri (feature#36651) has a trailing slash, the generated URLs are wrong. E.g.```yamlframework: router: default_uri: 'https://example.org/' # this is equivalent URI to 'https://example.org' ```Generating any absolute URL given this base path currently resulted in double slashes, e.g. `https://example.org//mypage`because the base url is set to `/` and the path info defaults to `/` as well. This is not correct and will result in a 404.The most consistent fix with the rest of symfony is to always rtrim the trailing slashes from the base url.This is already done in the HttpFoundation Request class seehttps://github.com/symfony/symfony/blob/674ad07a684fe1274ae49d9f4b6294ede3b47b92/src/Symfony/Component/HttpFoundation/Request.php#L849So I think it makes sense to enforce this also on the requestcontext so it is also the case when it does not go through the fromRequest but via fromUri in the CLI.Commits-------07136a9 [Routing] fix router base url when default uri has trailing slashFile tree
2 files changed
+46
-1
lines changed- src/Symfony/Component/Routing
- Tests
2 files changed
+46
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
101 | | - | |
| 101 | + | |
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
| |||
Lines changed: 45 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
43 | 88 | | |
44 | 89 | | |
45 | 90 | | |
| |||
0 commit comments
Comments
(0)