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 GoetzGoerisch committed Jan 13, 2022
1 parent a3eb948 commit eedd14f
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 eedd14f

Please sign in to comment.