-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Deobfuscate string cleanup while expanding URLs #13162
Conversation
src/service/url-expander/expander.js
Outdated
@@ -134,6 +134,9 @@ export class Expander { | |||
if (!ignoringChars) { | |||
ignoringChars = true; | |||
nextArgShouldBeRaw = true; | |||
user().assert(builder === '' || builder === ' ', |
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.
builder.trim() === ''
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.
do you think we should allow n number of whitespaces? I was trying to prevent this:
REPLACE(hello-world, `-`)
edit: github wont let me do it lol. Basically a bunch of whitespace between first and second arg
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.
It's currently allowed.
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.
good point.
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.
done
can you add a test case? expect().to.throw() |
* Deobfuscate url string cleanup * Clean up check * write test * fix test
* Deobfuscate url string cleanup * Clean up check * write test * fix test
If a user gives a bad input like
REPLACE(vanishing`hello-word`, `-`)
the stringvanishing
will get removed. Instead of swallowing the error we should tell the user.Open to bike-shedding about the actual warning sentence.