diff --git a/packages/karbon/src/runtime/composables/resources.ts b/packages/karbon/src/runtime/composables/resources.ts index 3bcef5a9..c76b238d 100644 --- a/packages/karbon/src/runtime/composables/resources.ts +++ b/packages/karbon/src/runtime/composables/resources.ts @@ -197,11 +197,12 @@ function getContextFor(type: Resources | string) { } async function convertToId(scope: PayloadScope, resourceID: any): Promise { - const { id, slug, sid } = resourceID + const { id, slug: _slug, sid } = resourceID if (id) { return id } const idComparisonMap = await loadStoripressPayload(scope, '__map', true) + const slug = decodeURIComponent(_slug ?? '') return (slug ? idComparisonMap.slugs[slug] : idComparisonMap.sids[sid]) ?? null } diff --git a/packages/karbon/src/runtime/routes/payload-handler.ts b/packages/karbon/src/runtime/routes/payload-handler.ts index 9e2f1079..892af7e1 100644 --- a/packages/karbon/src/runtime/routes/payload-handler.ts +++ b/packages/karbon/src/runtime/routes/payload-handler.ts @@ -95,7 +95,8 @@ export function definePayloadHandler({ const items = await listAll(true) const initial = { slugs: {}, sids: {} } - return items.reduce((target, { id, slug, sid }) => { + return items.reduce((target, { id, slug: _slug, sid }) => { + const slug = decodeURIComponent(_slug ?? '') slug && Object.assign(target.slugs, { [slug]: id }) sid && Object.assign(target.sids, { [sid]: id }) return target