This repository was archived by the owner on Jul 12, 2022. It is now read-only.
Prevent JavaScript error on malformed URI#11
Merged
KittyGiraudel merged 1 commit intomasterfrom Jan 18, 2018
Merged
Conversation
Tom-Bonnike
previously approved these changes
Jan 18, 2018
Contributor
Tom-Bonnike
left a comment
There was a problem hiding this comment.
Yea. Guess we don’t need a test for it?
d228369 to
29e3215
Compare
29e3215 to
09f30dd
Compare
Contributor
Author
|
@Tom-Bonnike We do. Added. |
Tom-Bonnike
approved these changes
Jan 18, 2018
| }) | ||
|
|
||
| it('should not throw if failing to decode query from request', function () { | ||
| var request = getMockedRequest({ query: { locale: '/at//%c0%ae%c0%ae%c0%ae%c0%c0%a%c0%c0%c0%c0%af%c0%af%c0%af%c0%c0%ae%c0%c0%ae%c0%ae%c0%afwindowswin.ini' } }) |
Contributor
Author
There was a problem hiding this comment.
This is an example of URL used to DDoS us.
| return request.query[key] ? decodeURIComponent(request.query[key]) : null | ||
| } catch (error) { | ||
| return null | ||
| } |
Contributor
There was a problem hiding this comment.
I prefered when you let it fail before but doesn’t matter 😄
Contributor
Author
There was a problem hiding this comment.
Well but that’s the entire problem.
Contributor
There was a problem hiding this comment.
No. What I meant is, before you rebased you wrote:
try {
return decodeURIComponent(request.query[key])
} catch (error) {
return null
}
Contributor
There was a problem hiding this comment.
Oh but passing undefined doesn’t throw an error. Ok :)
Contributor
Author
There was a problem hiding this comment.
That doesn’t do the same thing, all tests were failing. decodeURIComponent(undefined) === 'undefined'.
This file contains hidden or 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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
No description provided.