Skip to content

Commit

Permalink
Fix dat:// urls not resolving on web
Browse files Browse the repository at this point in the history
  • Loading branch information
RangerMauve committed Oct 8, 2019
1 parent fecc6e2 commit 0ba4031
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
6 changes: 5 additions & 1 deletion dns-web.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ module.exports = ({
}
if (!cb) cb = noop

const domain = url.slice(DAT_PROTOCOL.length)
let domain = url

if (domain.startsWith(DAT_PROTOCOL)) {
domain = url.slice(DAT_PROTOCOL.length)
}

if (cache[domain]) {
if (cb) {
Expand Down
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ const DEFAULT_DRIVE_OPTS = {
persist: true
}
const DEFAULT_CORE_OPTS = {
sparse: true,
persist: true
sparse: true,
persist: true
}
const DEFAULT_DNS_OPTS = {}

Expand Down
2 changes: 1 addition & 1 deletion promise.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ module.exports = function SDK (opts) {
}
}

key = await DatArchive.resolveName(hostname)
key = await DatArchive.resolveName(`dat://${hostname}`)
}

return {
Expand Down

0 comments on commit 0ba4031

Please sign in to comment.