Fix #2326 - Redirect to localhost when on 0.0.0.0#2328
Merged
Conversation
There was a problem hiding this comment.
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (2)
core/src/zero-redirect.js:4
- Catching all errors via a generic catch may inadvertently hide unexpected errors unrelated to crypto.randomUUID() support. Consider explicitly checking for the existence of crypto.randomUUID() if possible.
catch (_) { // eslint-disable-line
core/src/zero-redirect.js:5
- [nitpick] While the conditional check is clear, consider enclosing the subsequent redirection action in braces to improve clarity and reduce potential errors if additional lines are added later.
if (location.href.startsWith('http://0.0.0.0'))
WebReflection
commented
Apr 7, 2025
| try { | ||
| crypto.randomUUID(); | ||
| } catch (_) { | ||
| // eslint-disable-next-line |
Contributor
Author
There was a problem hiding this comment.
pre commit here is likely breaking the build ... that comment is meant to be before the catch, not after
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This MR fixes #2326 by simply avoiding users to visit directly
http://0.0.0.0as:127.0.0.1for loopback0.0.0.0is not really an address and nothing on the Web can reach that addressSo with this simple check that error people using
python -m http.server, which hints to reach that broken address by default, will be redirected tolocalhost.Changes
Checklist
make buildworks locally.