Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure posix compliant joins for urls in middleware #11640

Merged
merged 1 commit into from Jan 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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