Skip to content

Commit

Permalink
chore: normalize path before joining
Browse files Browse the repository at this point in the history
  • Loading branch information
haoqunjiang committed Aug 26, 2018
1 parent c9ae2f3 commit 35c31a4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ module.exports = function wrapper(context) {
throw new DevMiddlewareError('next');
}

filename = path.posix.join(filename, index);
filename = path.posix.join(path.normalize(filename), index);
stat = context.fs.statSync(filename);
if (!stat.isFile()) {
throw new DevMiddlewareError('next');
Expand Down
4 changes: 2 additions & 2 deletions lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ module.exports = {
if (process.platform === 'win32') {
// Path Handling for Microsoft Windows
if (filename) {
uri = path.posix.join((outputPath || ''), querystring.unescape(filename));
uri = path.posix.join(path.normalize(outputPath || ''), querystring.unescape(filename));

if (!pathabs.win32(uri)) {
uri = `/${uri}`;
Expand All @@ -104,7 +104,7 @@ module.exports = {

// Path Handling for all other operating systems
if (filename) {
uri = path.posix.join((outputPath || ''), filename);
uri = path.posix.join(path.normalize(outputPath || ''), filename);

if (!pathabs.posix(uri)) {
uri = `/${uri}`;
Expand Down

0 comments on commit 35c31a4

Please sign in to comment.