Skip to content

Commit

Permalink
fix: ipfs.io/blog on Chromium
Browse files Browse the repository at this point in the history
  • Loading branch information
lidel committed Feb 12, 2020
1 parent 5da02c9 commit ea4dd2c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion add-on/src/lib/ipfs-request.js
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,13 @@ function createRequestModifier (getState, dnslinkResolver, ipfsPathValidator, ru
request.statusCode === 404 &&
request.url.match(/\/\/[^/]+\/ipns\/ipfs\.io\/blog\//)) {
log('onCompleted: fixing /ipns/ipfs.io/blog → /ipns/blog.ipfs.io')
return browser.tabs.update({ url: request.url.replace('/ipns/ipfs.io/blog', '/ipns/blog.ipfs.io') })
const fixedUrl = request.url.replace('/ipns/ipfs.io/blog', '/ipns/blog.ipfs.io')

// Chromium bug: sometimes tabs.update does not work from onCompleted,
// we run additional update after 1s just to be sure
setTimeout(() => browser.tabs.update({ url: fixedUrl }), 1000)

return browser.tabs.update({ url: fixedUrl })
}

let redirectUrl
Expand Down

0 comments on commit ea4dd2c

Please sign in to comment.