Skip to content

Commit

Permalink
fix: avoid double // at end of url (#30)
Browse files Browse the repository at this point in the history
* fix: avoid double `//` at end of url

* fix: remove withoutLeadingSlash call
  • Loading branch information
danielroe committed Jun 15, 2022
1 parent 53e4c46 commit 2322064
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/index.ts
Expand Up @@ -4,7 +4,7 @@ import https from 'https'
import { promisify } from 'util'
import { promises as fs } from 'fs'
import { networkInterfaces } from 'os'
import { withoutLeadingSlash } from 'ufo'
import { joinURL } from 'ufo'
import { cyan, gray, underline, bold } from 'colorette'
import type { SelfsignedOptions } from 'selfsigned'
import { getPort, GetPortInput } from 'get-port-please'
Expand Down Expand Up @@ -118,12 +118,12 @@ export async function listen (handle: http.RequestListener, opts: Partial<Listen
const showURL = (options?: ShowURLOptions) => {
const add = opts.clipboard ? gray('(copied to clipboard)') : ''
const lines = []
const baseURL = withoutLeadingSlash(options?.baseURL || opts.baseURL || '')
const baseURL = options?.baseURL || opts.baseURL || ''
const name = options?.name ? ` (${options.name})` : ''
lines.push(` > Local${name}: ${formatURL(url + baseURL)} ${add}`)
lines.push(` > Local${name}: ${formatURL(joinURL(url, baseURL))} ${add}`)
if (isExternal) {
for (const ip of getExternalIps()) {
lines.push(` > Network${name}: ${formatURL(url.replace('localhost', ip) + baseURL)}`)
lines.push(` > Network${name}: ${formatURL(joinURL(url.replace('localhost', ip), baseURL))}`)
}
}
// eslint-disable-next-line no-console
Expand Down

0 comments on commit 2322064

Please sign in to comment.