-
Notifications
You must be signed in to change notification settings - Fork 212
Fix issue #187 #327
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
Fix issue #187 #327
Conversation
if (filterState.tags) { | ||
filterStateTags = Array.isArray(filterState.tags) ? filterState.tags.join(',') : | ||
Object.keys(filterState.tags).map(key => filterState.tags[key]).join(','); | ||
} |
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.
- For such checks we prefer to use lodash functions.
- Is really possible that we can get either array either object here? It looks strange.
const filterSubtracks = state.subtracks.map(item => | ||
const subtracks = Array.isArray(state.subtracks) ? state.subtracks : | ||
Object.keys(state.subtracks).map(key => state.subtracks[key]); | ||
const filterSubtracks = subtracks.map(item => |
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.
Especially here. It is just documented in the module's head comment that tags
and subtracks
must be arrays. So if it gets called with object, it is an error to be fixed somewhere else.
@birdofpreyru I found another way to solve this bug, please check again |
89bded2
to
d733a6e
Compare
src/server/server.js
Outdated
@@ -34,6 +35,8 @@ const app = express(); | |||
* fix. */ | |||
global.atob = atob; | |||
|
|||
app.set('query parser', str => qs.parse(str, { arrayLimit: 1000 })); |
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.
@elfman It looks like you found the correct reason behind the issue, but I don't like this way solving it. The reason qs
limits possible array lengths and turns array elements with indices larger than 20 into objects is the following: say you set limit 1000, then it is legit to send query param x[999]=... and the backend will have to create an array with 1000 elements for this param. I guess, it opens a very easy way to spam the server, if somebody wants to: you just send in a query like x[999]=a&y[999]=b&... and server will have lots of fun creating a big array for each of params.
So, I guess, we better just account in the reducer that long arrays are actually parsed as objects.
@birdofpreyru Updated |
29452b8
to
ea65797
Compare
No description provided.