Skip to content

Commit 79a83bc

Browse files
committed
fix(ssr): file path
1 parent 81c87f7 commit 79a83bc

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

packages/docsify-server-renderer/index.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { Compiler } from '../../src/core/render/compiler'
55
import { isAbsolutePath } from '../../src/core/router/util'
66
import { readFileSync } from 'fs'
77
import { resolve, basename } from 'path'
8+
import resolvePathname from 'resolve-pathname'
89

910
function cwd (...args) {
1011
return resolve(process.cwd(), ...args)
@@ -131,7 +132,7 @@ export default class Renderer {
131132

132133
const fileName = basename(filePath)
133134

134-
return await this._loadFile(cwd(filePath, '../..', fileName))
135+
return await this._loadFile(resolvePathname(`../${fileName}`, filePath))
135136
}
136137
}
137138
}

src/core/router/util.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export function getPath (...args) {
3636
}
3737

3838
export const isAbsolutePath = cached(path => {
39-
return /(:|(\/{2}))/.test(path)
39+
return /(:|(\/{2}))/g.test(path)
4040
})
4141

4242
export const getParentPath = cached(path => {

0 commit comments

Comments
 (0)