Skip to content

Commit

Permalink
fix(http): invalid ipv6 hostname printed to console (#5924)
Browse files Browse the repository at this point in the history
  • Loading branch information
marvinhagemeister authored Sep 10, 2024
1 parent b3e1ebb commit 9f19c9a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion http/file_server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -842,7 +842,10 @@ function main() {
const host = (Deno.build.os === "windows" && hostname === "0.0.0.0")
? "localhost"
: hostname;
let message = `Listening on:\n- Local: ${protocol}://${host}:${port}`;

const formattedHost = hostname.includes(":") ? `[${host}]` : host;
let message =
`Listening on:\n- Local: ${protocol}://${formattedHost}:${port}`;
if (networkAddress && !DENO_DEPLOYMENT_ID) {
message += `\n- Network: ${protocol}://${networkAddress}:${port}`;
}
Expand Down

0 comments on commit 9f19c9a

Please sign in to comment.