Skip to content

Commit 3ad7592

Browse files
authored
Follow redirects
Match changes in dat-ecosystem-archive/dat-dns/pull/27.
1 parent 2c0fb34 commit 3ad7592

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

background/dat-dns.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ export function resolveName(host) {
77
if (wellKnownCache.has(host)) {
88
resolve(Promise.resolve(wellKnownCache.get(host)));
99
}
10-
fetch(`https://${host}/.well-known/dat`, { redirect: 'manual' }).then((resp) => {
11-
if (resp.ok) {
10+
fetch(`https://${host}/.well-known/dat`, { redirect: 'follow' }).then((resp) => {
11+
if (resp.ok && new URL(resp.url).protocol == 'https:') {
1212
return resp.text().then(text => {
1313
try {
1414
return /^dat:\/\/([0-9a-f]{64})/i.exec(text.split('/n')[0])[1];
@@ -27,4 +27,4 @@ export function resolveName(host) {
2727
resolve(address);
2828
});
2929
});
30-
}
30+
}

0 commit comments

Comments
 (0)