mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-02 03:37:48 +02:00
fix: path/url joining bug on windows (#1064)
* fix error while using multiple level directory * fix error while using non-english file name
This commit is contained in:
parent
12fd204840
commit
8663a63e7d
2 changed files with 2 additions and 2 deletions
|
@ -110,7 +110,7 @@ function execute(port) {
|
|||
const app = express();
|
||||
|
||||
app.get(routing.docs(siteConfig.baseUrl), (req, res, next) => {
|
||||
const url = req.path.toString().replace(siteConfig.baseUrl, '');
|
||||
const url = decodeURI(req.path.toString().replace(siteConfig.baseUrl, ''));
|
||||
const metadata =
|
||||
Metadata[
|
||||
Object.keys(Metadata).find(id => Metadata[id].permalink === url)
|
||||
|
|
|
@ -12,7 +12,7 @@ const path = require('path');
|
|||
const escapeStringRegexp = require('escape-string-regexp');
|
||||
|
||||
function getSubDir(file, refDir) {
|
||||
const subDir = path.dirname(path.relative(refDir, file)).replace('\\', '/');
|
||||
const subDir = path.dirname(path.relative(refDir, file)).replace(/\\/g, '/');
|
||||
return subDir !== '.' && !subDir.includes('..') ? subDir : null;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue