Skip to content

"Copy to locale" redirect incorrectly when admin route is "/" #12558

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
anyuj opened this issue May 26, 2025 · 0 comments · May be fixed by #12560
Open

"Copy to locale" redirect incorrectly when admin route is "/" #12558

anyuj opened this issue May 26, 2025 · 0 comments · May be fixed by #12560

Comments

@anyuj
Copy link
Contributor

anyuj commented May 26, 2025

Describe the Bug

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.

Here is my PR #12560, it uses payload's formatAdminURL helper function to form the redirect URL appropriately.

Link to the code that reproduces this issue

https://github.com/anyuj/wrong-redirect-route-for-copy-locale

Reproduction Steps

Use above repo or:

  1. create blank payload project and upgrade to latest version.
  2. move files inside admin folder to the root path, and set payload config routes:{ admin:`/` }
  3. add localization settings in payload config
  4. create a sample collection, and set one of the field localized. Then create a sample document.
  5. Enter the edit view of the document you just created, click Copy to Locale from the 3-dot next to Save button
  6. Then you will see it will be falsely direct to "http://collections/{sampleCollectionSlug}/{documentID}?locale={toLocale}"

Which area(s) are affected? (Select all that apply)

area: core

Environment Info

Payload: 3.39.1
Next.js: 15.3.2
Node: ^22
@anyuj anyuj added status: needs-triage Possible bug which hasn't been reproduced yet validate-reproduction Auto-added tag on create to tell bot to check recreation URL, removed after check. labels May 26, 2025
@github-actions github-actions bot added created-by: Contributor and removed validate-reproduction Auto-added tag on create to tell bot to check recreation URL, removed after check. labels May 26, 2025
@anyuj anyuj changed the title "Copy to locale" redirect falsely when admin route is "/" "Copy to locale" redirect incorrectly when admin route is "/" May 26, 2025
@JarrodMFlesch JarrodMFlesch self-assigned this May 27, 2025
@github-actions github-actions bot removed the status: needs-triage Possible bug which hasn't been reproduced yet label May 27, 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 a pull request may close this issue.

2 participants