Skip to content

Commit

Permalink
fix(ssr): file path
Browse files Browse the repository at this point in the history
  • Loading branch information
QingWei-Li committed May 30, 2017
1 parent 81c87f7 commit 79a83bc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion packages/docsify-server-renderer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Compiler } from '../../src/core/render/compiler'
import { isAbsolutePath } from '../../src/core/router/util'
import { readFileSync } from 'fs'
import { resolve, basename } from 'path'
import resolvePathname from 'resolve-pathname'

function cwd (...args) {
return resolve(process.cwd(), ...args)
Expand Down Expand Up @@ -131,7 +132,7 @@ export default class Renderer {

const fileName = basename(filePath)

return await this._loadFile(cwd(filePath, '../..', fileName))
return await this._loadFile(resolvePathname(`../${fileName}`, filePath))
}
}
}
2 changes: 1 addition & 1 deletion src/core/router/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export function getPath (...args) {
}

export const isAbsolutePath = cached(path => {
return /(:|(\/{2}))/.test(path)
return /(:|(\/{2}))/g.test(path)
})

export const getParentPath = cached(path => {
Expand Down

0 comments on commit 79a83bc

Please sign in to comment.