-
Notifications
You must be signed in to change notification settings - Fork 324
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
fix(recovery): 🐛 false-positive for non-gateway URLs #1163
Changes from 4 commits
0d765a5
6796c9d
91a9567
74cb934
78ce18d
5fd1816
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -144,7 +144,11 @@ export function createRequestModifier (getState, dnslinkResolver, ipfsPathValida | |
|
||
// When local IPFS node is unreachable , show recovery page where user can redirect | ||
// to public gateway. | ||
if (!state.nodeActive && request.type === 'main_frame' && sameGateway(request.url, state.gwURL)) { | ||
if (!state.nodeActive && // node is not active | ||
!state.redirect && // this is not a redirect request | ||
request.type === 'main_frame' && // this is a request for a root document | ||
sameGateway(request.url, state.gwURL) // this is a request to the local gateway | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ℹ️ this was not enough to fix https://twitter.com/unicomp21/status/1626244123102679041 – this screen should never happen and user should not have to disable companion for this to go away.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for pointing this out, I was looking into the Is that wrong? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
you probably saw us setting it in tests per different requests to simultate specific flows, and assumed it is per request, but it is is not :) |
||
) { | ||
lidel marked this conversation as resolved.
Show resolved
Hide resolved
|
||
const publicUri = ipfsPathValidator.resolveToPublicUrl(request.url, state.pubGwURLString) | ||
return { redirectUrl: `${dropSlash(runtimeRoot)}${recoveryPagePath}#${encodeURIComponent(publicUri)}` } | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
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.
💭 nit: this is a global flag that controls if companion is redirecting requests to the local gateway, or not.
ℹ️ This was not fixing the problem, and the comment was only confusing the reader – I've restored old version and applied proper fix in
sameGateway
.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.
#1163 (comment)