Skip to content
This repository was archived by the owner on Dec 11, 2024. It is now read-only.

Commit eedd14f

Browse files
Ensure posix compliant joins for urls in middleware (facebook#11640)
1 parent a3eb948 commit eedd14f

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

packages/react-dev-utils/noopServiceWorkerMiddleware.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const path = require('path');
1111

1212
module.exports = function createNoopServiceWorkerMiddleware(servedPath) {
1313
return function noopServiceWorkerMiddleware(req, res, next) {
14-
if (req.url === path.join(servedPath, 'service-worker.js')) {
14+
if (req.url === path.posix.join(servedPath, 'service-worker.js')) {
1515
res.setHeader('Content-Type', 'text/javascript');
1616
res.send(
1717
`// This service worker file is effectively a 'no-op' that will reset any

packages/react-dev-utils/redirectServedPathMiddleware.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ module.exports = function createRedirectServedPathMiddleware(servedPath) {
1919
) {
2020
next();
2121
} else {
22-
const newPath = path.join(servedPath, req.path !== '/' ? req.path : '');
22+
const newPath = path.posix.join(servedPath, req.path !== '/' ? req.path : '');
2323
res.redirect(newPath);
2424
}
2525
};

0 commit comments

Comments
 (0)