fix: opt-out from redirects done by browser extension

Context: https://github.com/ipfs-shipyard/ipfs-companion/pull/505
merge-requests/2/merge
Marcin Rataj 2018-06-27 12:37:55 +02:00
parent f2e23994be
commit 6dd5f510df
No known key found for this signature in database
GPG Key ID: 222B6784D5A79E42
1 changed files with 3 additions and 1 deletions

4
app.js
View File

@ -27,7 +27,9 @@ function checkGateways (gateways) {
let checked = 0
gateways.forEach((gateway) => {
const gatewayAndHash = gateway.replace(':hash', hashToTest)
fetch(gatewayAndHash)
// opt-out from gateway redirects done by browser extension
const testUrl = gatewayAndHash + '#x-ipfs-no-redirect'
fetch(testUrl)
.then(res => res.text())
.then((text) => {
const matched = text.trim() === hashString.trim()