If you think a bug might affect users in the 57 release, please set the correct tracking and status flags for Release Management.

kuma: Changing a document slug creates a broken redirect

RESOLVED FIXED

Status

Mozilla Developer Network
Editing
--
major
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: Nickolay_Ponomarev, Unassigned)

Tracking

Details

(Reporter)

Description

5 years ago
Steps to reproduce:
1. Create a new page test_redirect (via /en-US/docs/new), save it.
2. Edit the newly created page, click the (i) icon next to the title.
3. Change the document title and slug to something else (test_redirect2), save.
4. Visit the old URL (/en-US/docs/en-US/test_redirect).

Actual results: You get redirected to /en-US/en-US/docs/en-US/redirect_test2?redirectlocale=en-US&redirectslug=redirect_test, which does not match any of kuma's patterns and actually is handled by MindTouch.

Expected results: You should get redirected to the proper URL instead. (Currently /en-US/docs/en-US/redirect_test2, but this might change in bug 754534.)

I think this should be fixed before the launch (bug 756263), since IMO the proper fix affects the way the deki->kuma migration should work.


ANALYSIS:

The redirect document has this content:
   REDIRECT <a class="redirect" href="/en-US/docs/en-US/test_redirect2">test_redirect2</a>

The code added in bug 723242 <https://github.com/mozilla/kuma/commit/d5385d8cb35ee726ff751d55da884069c7859155> inserts an extra /en-US for redirects, which leads to the issue.

It seems that only redirects migrated from MT were considered in bug 723242. They are migrated as redirects to URLs like '/docs/en/Test_redirected' (see <https://github.com/mozilla/kuma/blob/18855d0929988d0e174242dfee7cfe236f130586/apps/dekicompat/management/commands/migrate_to_kuma_wiki.py#L618>), which is why the 'en-US' prepending logic was needed.

IMHO, the proper fix for bug 723242 (and for this bug) is to:
1) Finalize the canonical URLs for kuma wiki pages (bug 754534)
2) Make sure the redirects migrated from MT point to the canonical URLs (i.e. if the scheme in bug 754534 comment 14 is accepted, the migrated redirects' target would be not '/docs/en/Test_redirected', but '/en-US/docs/Test_redirected')
3) Remove the code added in bug 723242.
I'm fairly certain this is no longer an issue.  The second locale part of the URL has been removed, and following these instructions (but going to /en-US/docs/test_redirect) works great.

PLease reopen if I'm wrong.
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
(Assignee)

Updated

5 years ago
Version: Kuma → unspecified
(Assignee)

Updated

5 years ago
Component: Docs Platform → Editing
Product: Mozilla Developer Network → Mozilla Developer Network
You need to log in before you can comment on or make changes to this bug.