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

Sailthru script fix, and updates #34

Merged
merged 2 commits into from
Mar 2, 2020
Merged

Conversation

ashfurrow
Copy link
Contributor

@ashfurrow ashfurrow commented Feb 28, 2020

This fixes the Sailthru url-encoding script, as well as adds the log_in and sign_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 @ds300

I'll inline an explanation of the script fix, since Prettier made the changes hard to isolate.

@@ -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)))
Copy link
Contributor Author

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 "".

Copy link
Contributor

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 👍

Copy link
Contributor

@dleve123 dleve123 left a 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)))
Copy link
Contributor

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 👍

@ashfurrow ashfurrow merged commit faf724b into master Mar 2, 2020
@ashfurrow ashfurrow deleted the sailthr-script-fix-and-updates branch March 2, 2020 15:58
@artsyit
Copy link
Contributor

artsyit commented Nov 2, 2021

🚀 PR was released in v1.1.0 🚀

@artsyit artsyit added the released This issue/pull request has been released. label Nov 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released This issue/pull request has been released.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants