Skip to content

Commit

Permalink
fix urls
Browse files Browse the repository at this point in the history
  • Loading branch information
rauchg committed Jul 15, 2016
1 parent 7ffa830 commit 00eda26
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions bin/list
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import filesize from 'filesize'
import { version } from '../../package'
import mime from 'mime'
import toPromise from 'denodeify'
import { parse } from 'url'

args
.option('port', 'Port to listen on', 3000)
Expand Down Expand Up @@ -159,10 +160,11 @@ const renderDirectory = dir => {
}

const server = micro(async (req, res) => {
let related = path.parse(path.join(current, req.url))
const { pathname } = parse(req.url)
let related = path.parse(path.join(current, pathname))

if (related.dir.indexOf(process.env.ASSET_DIR) > -1) {
const relative = path.relative(process.env.ASSET_DIR, req.url)
const relative = path.relative(process.env.ASSET_DIR, pathname)
related = path.parse(path.join(__dirname, '/../assets', relative))
}

Expand Down

0 comments on commit 00eda26

Please sign in to comment.