-
Notifications
You must be signed in to change notification settings - Fork 5
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
Sailthru script fix, and updates #34
Conversation
@@ -47,7 +47,7 @@ function isNotSailthruPattern(pattern) { | |||
*/ | |||
function encodePattern(pattern) { | |||
const path = pattern.match(/^NOT (.+)$/)[1] | |||
const encoded = encodePath(path.slice(0, -(path.length % 3))) | |||
const encoded = encodePath(path.slice(0, path.length - (path.length % 3))) |
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.
This is the fix. The docs for slice()
describe how it works when the argument is negative – it's a shorthand for what I've written out here. The bug was that, if path.length
is exactly a multiple of 3, then -(path.length % 3)
evaluates to -0
, and slice()
returns ""
.
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.
that's a hell of a bugfix @ashfurrow 👍
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.
Looks great – as we discussed, we'll merge as is to improve service quality, but plan on following up with a test suite considering how tricky this stuff is.
@@ -47,7 +47,7 @@ function isNotSailthruPattern(pattern) { | |||
*/ | |||
function encodePattern(pattern) { | |||
const path = pattern.match(/^NOT (.+)$/)[1] | |||
const encoded = encodePath(path.slice(0, -(path.length % 3))) | |||
const encoded = encodePath(path.slice(0, path.length - (path.length % 3))) |
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.
that's a hell of a bugfix @ashfurrow 👍
🚀 PR was released in |
This fixes the Sailthru url-encoding script, as well as adds the
log_in
andsign_up
paths to the excluded list. I noticed this was opened in a crash that inexplicably caused a stack overflow. I don't understand it, but in any case, we shouldn't be linking into the app on these URLs because the app doesn't know how to route them correctly. /cc @ds300I'll inline an explanation of the script fix, since Prettier made the changes hard to isolate.