Skip to content

Commit

Permalink
Ensure posix compliant joins for urls in middleware (facebook#11640)
Browse files Browse the repository at this point in the history
  • Loading branch information
psiservices-justin-sullard authored and abhiisheek committed May 24, 2023
1 parent be8ac4e commit abc9b61
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/react-dev-utils/noopServiceWorkerMiddleware.js
Expand Up @@ -11,7 +11,7 @@ const path = require('path');

module.exports = function createNoopServiceWorkerMiddleware(servedPath) {
return function noopServiceWorkerMiddleware(req, res, next) {
if (req.url === path.join(servedPath, 'service-worker.js')) {
if (req.url === path.posix.join(servedPath, 'service-worker.js')) {
res.setHeader('Content-Type', 'text/javascript');
res.send(
`// This service worker file is effectively a 'no-op' that will reset any
Expand Down
2 changes: 1 addition & 1 deletion packages/react-dev-utils/redirectServedPathMiddleware.js
Expand Up @@ -19,7 +19,7 @@ module.exports = function createRedirectServedPathMiddleware(servedPath) {
) {
next();
} else {
const newPath = path.join(servedPath, req.path !== '/' ? req.path : '');
const newPath = path.posix.join(servedPath, req.path !== '/' ? req.path : '');
res.redirect(newPath);
}
};
Expand Down

0 comments on commit abc9b61

Please sign in to comment.