Skip to content
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

Automatic redirection of old-type URLs #5056

Closed
wants to merge 7 commits into from
Closed

Automatic redirection of old-type URLs #5056

wants to merge 7 commits into from

Conversation

Pandapip1
Copy link
Member

@Pandapip1 Pandapip1 commented Apr 29, 2022

Fixes #5054, #5052

@eth-bot
Copy link
Collaborator

eth-bot commented Apr 29, 2022

A critical and unhandled exception has occurred:
Message: not found
Data: (there is no data for this error)(cc @alita-moore, @mryalamanchi)

@Pandapip1
Copy link
Member Author

Pandapip1 commented Apr 29, 2022

There's the bug again. Can ethereum/EIP-Bot#63 be fixed sooner rather than later?

Active editor CC: @lightclient, @MicahZoltu, @SamWilsn

@Pandapip1
Copy link
Member Author

Pandapip1 commented Apr 29, 2022

For greater forwards compatibility
There is no longer a mistake in the regex
@Pandapip1
Copy link
Member Author

I'm temporarily changing the GitHub pages branch to #5055 to debug why the LICENCE file isn't working.

@MicahZoltu
Copy link
Contributor

This feels like unnecessary complexity. I think EIP-20 is the only EIP that would match the regex, and no one should be using that link anymore. I would rather just set an EOL on the mis-named EIP-20 and delete it once we reach that EOL.

@Pandapip1
Copy link
Member Author

Pandapip1 commented May 4, 2022

Is there any harm in merging this? It's not adding too much additional complexity (6 lines of pretty understandable JS code, which are now commented).

The rationale for this is so that we can remove the EIP 20 href, but still have the links redirect. This also has the advantage of also redirecting links that mistakenly add .md. It also would redirect all previous-type links correctly, and redirect it automatically.

Again, for 6 lines of code, I think it's worth it (to me, it seems to be a no-brainer). I understand the EIP editors may disagree. so I will leave this open until there is consensus.

@MicahZoltu MicahZoltu mentioned this pull request May 6, 2022
@MicahZoltu
Copy link
Contributor

This also has the advantage of also redirecting links that mistakenly add .md.

Is this a common problem? Do we have examples of live links that include .md? Why .md but not .txt (or any other possible typo)?

While I agree that 6 lines isn't much, many instances of "just 6 lines" can really add up in a project over time and that can turn into technical debt and bit rot. In general, I think that any feature addition, even if it is a single character code change, must reach a certain bar of necessity before being included in a project and to me it feels like this particular issue doesn't quite meet that bar.

@Pandapip1
Copy link
Member Author

Is this a common problem? Do we have examples of live links that include .md? Why .md but not .txt (or any other possible typo)?

It fixes the second typo too. If the user puts .html, .markdown, or even .thisisnotevenarealfileextensionoratleastitprobablyisntusedbyanyapplication, it'll properly redirect. Same with extra endings (e.g. eip-20-token_standard or something that never existed such as eip-4834-never_had_an_ending. Same with combinations: eip-20-token_standard.md also works.

I doubt it's a common problem. I very much don't think my code will contribute to code rot at all (it's pretty well documented), but I can add another comment.

Editor CC: @lightclient @SamWilsn @axic @gcolvin

@@ -2,6 +2,15 @@
layout: default
---

<script>
let thePath = window.location.pathname; // Fetches the path (e.g. "/EIPS/eip-20-token-standard" or "/core")
let theRegex = /^(.*\/EIPS\/eip-\d+)[^\d\s\/][^\/]*$/gm; // This regex matches the EIP path (e.g. "/EIPS/EIP-20") if the original path isn't valid
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I don't think this is exploitable (because you use pathname), I am uncomfortable with a redirect to a location in the URL.

@lightclient
Copy link
Member

@Pandapip1 thank you for this contribution! I think it is a good idea, maybe something to consider if we move the ERCs out of this repository. However, it doesn't seem terribly important given the current state of the repo. As most editors are against the change, I'm going to close this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Redirect legacy URLs
5 participants