-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
[now-dev] Fix route normalization #3225
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AndyBitz
approved these changes
Oct 30, 2019
TooTallNate
reviewed
Oct 30, 2019
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possible to add a test for this?
@TooTallNate I wrote a simple builder with a invalid regex route: const { join, dirname } = require('path');
const { download, glob, shouldServe } = require('@now/build-utils');
async function build({ files, entrypoint, workPath, meta = {} }) {
await download(files, workPath, meta);
const mountpoint = dirname(entrypoint);
const distPath = join(workPath, mountpoint);
const routes = [{src: '(*.)', dest: '/index.html'}]; // broken regex
const output = await glob('**', distPath, mountpoint);
const watch = [join(mountpoint.replace(/^\.\/?/, ''), '**/*')];
return { routes, output, watch };
};
module.exports = { version: 2, build, shouldServe }; Then I added a now dev test fixture to ensure this builder fails with the correct error message. |
leo
pushed a commit
that referenced
this pull request
Nov 11, 2019
This PR fixes a regression introduced in #3174 when removing the `^` and `$` normalization. The previous PR was normalizing user-defined routes but forgot to normalize builder routes. This PR normalizes builder routes 馃憤
comus
added a commit
to withcloud/now
that referenced
this pull request
Nov 23, 2019
* commit 'ba18a3a0cbada71104184d2fdb9b3d9bde48a193': (161 commits) [now-cli] Add note for Windows environment variable syntax (vercel#3243) [docs] Rename "Builders" to "Runtimes" (vercel#3256) Update Public Directory Link (vercel#3221) Publish [now-next] 404 Known Static Files Before Dynamic Routes (vercel#3238) Publish [now-cli] Adjust `now ls` according to new project overview (vercel#3229) [now dev] Add support for `cleanUrls` (vercel#3240) [now-cli] Fix test invalid-builder-routes (vercel#3249) [now-cli] Remove `now upgrade` command (vercel#3228) [now-dev] Fix route normalization (vercel#3225) Publish [now-build-utils] Fix custom function runtimes (vercel#3239) Publish [now-cli][now-client] Add support for `functions` property (vercel#3231) Publish Fix racing spinners (vercel#3232) Publish [now-routing-utils] Fix newline in error message (vercel#3234) [now-build-utils] Fix zero config trailing slash (vercel#3233) ... # Conflicts: # packages/now-node/package.json # packages/now-node/src/index.ts
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes a regression introduced in #3174 when removing the
^
and$
normalization.The previous PR was normalizing user-defined routes but forgot to normalize builder routes.
This PR normalizes builder routes 馃憤