-
Notifications
You must be signed in to change notification settings - Fork 547
feat(CLI): Make it possible to use an absolute URL when providing a redirect during a deletion #5814
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
feat(CLI): Make it possible to use an absolute URL when providing a redirect during a deletion #5814
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I approve of this change, though I think @schalkneethling would be a better judge of the code here.
Also, I'm surprised this didn't work already, since I used yarn content delete --redirect with absolute URLs a bunch of times for mdn/content#14140. π€
That's confusing. To be sure, I did fetch a whole new copy of mdn/content (and mdn/translated-content on my machine) and I get an error with the following:
FWIW |
|
Hmm. What error do you get? |
| if (dry) { | ||
| if (redirectUrl) { | ||
| Redirect.add(locale, [[url, buildURL(locale, redirectUrl)]], { dry }); | ||
| Redirect.add(locale, [[url, redirectUrl]], { dry }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not strictly related to what I intended to fix but it seemed to me that this was unecessary since redirectURL had already been built.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't realize that redirects can be made to external URLs, let alone absolute URLs -- apologies for breaking this in the first place, but thanks for fixing it up!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is yet another case for us documenting how the various parts of Yari works. This is something I am planing on doing very, very soon.
Summary
#5813
Problem
See #5813
This would help add redirects for deleted content which now lives outside of MDN (e.g. Fx DevTools)
Solution
I added a check to switch case when the URL is absolute (vs when it's not where it uses the existing logic)
Before
After
How did you test this change?
I ran the following command from
yaris directory:yarn tool delete Tools/3D_View fr --redirect https://firefox-source-docs.mozilla.org/devtools-user/3d_view/index.htmland then manually check the redirects file and ran
yarn tool validate-redirects fr --strict(resp. w/yarn contentundercontent)