payload icon indicating copy to clipboard operation
payload copied to clipboard

fix: ensure redirect route is correctly formatted for "Copy to locale"

Open anyuj opened this issue 8 months ago • 0 comments

What?

When you set admin route as "/" and enable localization, once you create a document in one locale and try to copy to another locale, it will redirect to http://collections/{sampleCollectionSlug}/{documentID}?locale={toLocale}, which doesn't work because it does not include the serverURL.

Why?

It used to redirect to ${serverURL}${admin}/${collectionSlug ? `collections/${collectionSlug}/${id}` : `globals/${globalSlug}`}?locale=${to}, but when admin is '/', and serverURL is not defined in payload config, it then redirect incorrectly

How?

I replaced the target url with formatAdminURL function in payload/shared to make it handle admin path appropriately

Fixes #12558

anyuj avatar May 26 '25 15:05 anyuj