plugin-app: substitute path params in app/routes redirect targets
The app/routes redirect config now performs the same :param and * substitution that the legacy Redirect component did before navigating. Named params captured by the `from` pattern are replaced in the `to` string, enabling redirects like /users/:userId → /profile/:userId and /old-docs → /docs/* (with splat forwarding). Adds tests for both named-param and splat substitution. Signed-off-by: Patrik Oldsberg <rugvip@backstage.io> Signed-off-by: Fredrik Adelöw <freben@spotify.com> Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
---
|
||||
'@backstage/plugin-app': patch
|
||||
---
|
||||
|
||||
The `app/routes` redirect config now supports path parameter substitution in the `to` target. Named params (`:userId`) and splat params (`*`) captured by the `from` path are replaced in the `to` string before navigating, making it possible to express redirects like:
|
||||
|
||||
```yaml
|
||||
app:
|
||||
extensions:
|
||||
- app/routes:
|
||||
config:
|
||||
redirects:
|
||||
- from: /users/:userId
|
||||
to: /profile/:userId
|
||||
- from: /old-docs
|
||||
to: /docs/*
|
||||
```
|
||||
Reference in New Issue
Block a user