Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

anyuj
Copy link
Contributor

@anyuj anyuj commented May 26, 2025

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 anyuj changed the title fix(localization): ensure redirect route is correctly formatted fix: ensure redirect route is correctly formatted May 26, 2025
@anyuj anyuj changed the title fix: ensure redirect route is correctly formatted fix: ensure redirect route is correctly formatted for "Copy to locale" May 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"Copy to locale" redirect incorrectly when admin route is "/"
2 participants