Skip to content
Merged

2.0.1 #263

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Changelog

- [2.0.1](doc/changelog/2.0.1.md) — 2026-08-17
- [2.0.0](doc/changelog/2.0.0.md) — 2026-08-17
- [1.29.0](doc/changelog/1.29.0.md) — 2026-06-15
- [1.28.0](doc/changelog/1.28.0.md) — 2026-03-11
Expand Down
13 changes: 13 additions & 0 deletions doc/changelog/2.0.1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
2.0.1 — 2026-08-17
===

### Fixed

- **Links into DAM held by other apps no longer 404.** 2.0.0 pluralized every route path and shipped
no redirect layer, so URLs stored outside this app broke. `/asset/:id`, `/asset/file/:id` and
`/user/:id/edit` now redirect to their plural counterparts, keeping params, query and hash.
The shim in `src/router/legacyRedirects.ts` is temporary and names what has to change before it can
be dropped: `DamAdminAssetLink.vue` in common-admin (rendered by admin-cms and admin-ugc) and
admin-cms' `DAM_USER_EDIT_URL_TEMPLATE`, whose value also lives in deployment pipeline variables.

[Compare with 2.0.0](https://github.com/anzusystems/admin-dam/compare/2.0.0...2.0.1)
8 changes: 7 additions & 1 deletion src/router/index.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
import { createRouter, createWebHistory } from 'vue-router'
import { routes, handleHotUpdate } from 'vue-router/auto-routes'
import { beforeEachRoute } from '@/router/beforeEachRoute'
import { addLegacyRedirects } from '@/router/legacyRedirects'

const vueRouter = createRouter({
history: createWebHistory(),
routes,
})

addLegacyRedirects(vueRouter)

if (import.meta.hot) {
handleHotUpdate(vueRouter)
// a hot update replaces the generated routes, dropping anything added at runtime
handleHotUpdate(vueRouter, () => {
addLegacyRedirects(vueRouter)
})
}

vueRouter.beforeEach(async (to) => {
Expand Down
35 changes: 35 additions & 0 deletions src/router/legacyRedirects.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import type { RouteLocation, Router } from 'vue-router'

/**
* TODO(#85491): temporary shim for the pre-2.0.0 singular route paths.
*
* 2.0.0 pluralized every route and shipped no redirect layer, so links held outside this app 404.
* Only the paths that are actually linked from elsewhere are covered here. Delete this file and
* both call sites in `./index.ts` once every consumer below points at the plural path:
*
* - `/asset/:id` — `DamAdminAssetLink.vue` in common-admin builds `adminDomain + '/asset/' + id`
* (rendered by admin-cms in the audio widget and the audio/video embed dialogs, by common-admin
* itself in the 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`.
* Lives in its `.env`, every developer's `.env.local` and `public/config.json`, and in the
* deployment pipeline variable — so this one outlives a single code change.
*/
// the legacy paths are not part of the generated route map, so `to.params` is typed as the
// union of every known route's params and needs narrowing
const legacyId = (to: RouteLocation) => (to.params as { id: string }).id

export const addLegacyRedirects = (router: Router) => {
router.addRoute({
path: '/asset/:id',
redirect: (to) => ({ name: '/(coreDam)/assets/[id]', params: { id: legacyId(to) } }),
})
router.addRoute({
path: '/asset/file/:id',
redirect: (to) => ({ name: '/(coreDam)/assets/file/[id]', params: { id: legacyId(to) } }),
})
router.addRoute({
path: '/user/:id/edit',
redirect: (to) => ({ name: '/(coreDam)/users/[id]/edit', params: { id: legacyId(to) } }),
})
}
Loading