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

Fix server when there is a dot in the path #2429

Merged
merged 2 commits into from Dec 18, 2018
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
13 changes: 13 additions & 0 deletions packages/core/integration-tests/test/server.js
Expand Up @@ -217,6 +217,19 @@ describe('server', function() {
);
});

it('should work with paths that contain a dot', async function() {
let b = bundler(path.join(__dirname, '/integration/html/index.html'), {
publicUrl: '/'
});
server = await b.serve(0);

let data = await get('/bar.baz');
assert.equal(
data,
await fs.readFile(path.join(__dirname, '/dist/index.html'), 'utf8')
);
});

it('should not log dev server access for log level <= 3', async function() {
let b = bundler(path.join(__dirname, '/integration/html/index.html'), {
publicUrl: '/'
Expand Down
2 changes: 1 addition & 1 deletion packages/core/parcel-bundler/src/Server.js
Expand Up @@ -63,7 +63,7 @@ function middleware(bundler) {
} else {
// Otherwise, serve the file from the dist folder
req.url = pathname.slice(bundler.options.publicURL.length);
return serve(req, res, send404);
return serve(req, res, sendIndex);
}
}

Expand Down