Skip to content

Commit

Permalink
fix: normalize catch-all listeners to loopback
Browse files Browse the repository at this point in the history
Closes #1821
  • Loading branch information
lidel committed Oct 31, 2024
1 parent 682de0b commit bc0f822
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/bundles/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,11 @@ function getURLFromAddress (name, config) {
if (!config) return null

try {
const address = Array.isArray(config.Addresses[name])
const address = (Array.isArray(config.Addresses[name])

Check warning on line 94 in src/bundles/config.js

View check run for this annotation

Codecov / codecov/patch

src/bundles/config.js#L94

Added line #L94 was not covered by tests
? config.Addresses[name][0]
: config.Addresses[name]
: config.Addresses[name])
.replace(/\/0\.0\.0\.0\//, '/127.0.0.1/') // fix for https://github.com/ipfs/ipfs-webui/issues/1821
.replace(/\/::\//, '/::1/')
const url = toUri(address, { assumeHttp: true })
if (new URL(url).port === 0) throw Error('port set to 0, not deterministic')
return url
Expand Down

0 comments on commit bc0f822

Please sign in to comment.