Skip to content

Commit

Permalink
fix: no dnslink lookup when turned off (#823)
Browse files Browse the repository at this point in the history
Closes #821
  • Loading branch information
lidel authored Dec 3, 2019
1 parent 53ec312 commit 68c9bd0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion add-on/src/lib/ipfs-companion.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ module.exports = async function init () {
} catch (error) {
info.gatewayVersion = null
}
if (info.currentTab) {
if (state.active && info.currentTab) {
const url = info.currentTab.url
info.isIpfsContext = ipfsPathValidator.isIpfsPageActionsContext(url)
info.currentDnslinkFqdn = dnslinkResolver.findDNSLinkHostname(url)
Expand Down
3 changes: 2 additions & 1 deletion add-on/src/lib/ipfs-request.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ function createRequestModifier (getState, dnslinkResolver, ipfsPathValidator, ru
// This is a good place to listen if you want to cancel or redirect the request.
onBeforeRequest (request) {
const state = getState()
if (!state.active) return
// early sanity checks
if (preNormalizationSkip(state, request)) {
return
Expand All @@ -131,7 +132,7 @@ function createRequestModifier (getState, dnslinkResolver, ipfsPathValidator, ru
}
}
// handle redirects to custom gateway
if (state.active && state.redirect) {
if (state.redirect) {
// late sanity checks
if (postNormalizationSkip(state, request)) {
return
Expand Down

0 comments on commit 68c9bd0

Please sign in to comment.