fix: redirect the pre-2.0.0 singular route paths (#85491) - #262
Merged
Conversation
2.0.0 pluralized every route path and added no redirect layer, so links to admin-dam held by other apps 404. A search through common-admin and admin-cms turned up three paths that are still linked from outside: - /asset/:id — built by DamAdminAssetLink.vue in common-admin, rendered by admin-cms (audio widget, audio/video embed dialogs), by common-admin itself (image detail dialog) and inherited by admin-ugc. - /asset/file/:id — asset-file detail, linked from an external library. - /user/:id/edit — admin-cms DAM_USER_EDIT_URL_TEMPLATE, opened by SystemUserEditButton.vue. Its value lives in .env, every developer's .env.local, the generated public/config.json and the deployment pipeline variables, so it outlives a single code change. They are added with router.addRoute() and re-added inside the handleHotUpdate callback, because a hot update replaces the generated routes and drops anything added at runtime. Redirect targets are route names rather than paths so the anzu-local/valid-route-name lint rule fails loudly if a page file is renamed, instead of the shim silently redirecting to a 404. Verified by navigating a memory-history router: all three redirect to the plural path with params, query and hash preserved, and the plural paths are unaffected. The shim is temporary; the TODO in src/router/legacyRedirects.ts lists what has to change before it can be removed.
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
2.0.0 pluralized every route path and added no redirect layer, so links to admin-dam held by other
apps 404. A search through common-admin and admin-cms turned up three paths that are still linked
from outside:
/asset/:id— built byDamAdminAssetLink.vuein common-admin, rendered by admin-cms (audiowidget, audio/video embed dialogs), by common-admin itself (image detail dialog) and inherited by
admin-ugc.
/asset/file/:id— asset-file detail, linked from an external library./user/:id/edit— admin-cmsDAM_USER_EDIT_URL_TEMPLATE, opened bySystemUserEditButton.vue.Its value lives in
.env, every developer's.env.local, the generatedpublic/config.jsonandthe deployment pipeline variables, so it outlives a single code change.
They are added with
router.addRoute()and re-added inside thehandleHotUpdatecallback, because ahot update replaces the generated routes and drops anything added at runtime. Redirect targets are
route names rather than paths, so the
anzu-local/valid-route-namelint rule fails loudly if apage file is renamed instead of the shim silently redirecting to a 404.
The shim is temporary — the TODO in
src/router/legacyRedirects.tslists what has to change beforeit can be removed.
Verification
yarn lintclean (vue-tsc, oxlint, eslint, stylelint).query and hash preserved (
/asset/abc?tab=meta#roi→/assets/abc?tab=meta#roi), and the pluralpaths are unaffected.
^/assets/?$, so the legacy paths fall through the defaulttry_filestoindex.htmland reach the SPA.Released as 2.0.1 — see
doc/changelog/2.0.1.md.