Merge pull request #3184 from jaswilli/issue-3169

Fix up route parameter validation
This commit is contained in:
Hannah Wolfe 2014-07-02 21:37:00 +01:00
commit 012b93a885
2 changed files with 5 additions and 4 deletions

View File

@ -10,8 +10,8 @@ var EditorEditRoute = Ember.Route.extend(Ember.SimpleAuth.AuthenticatedRouteMixi
postId = Number(params.post_id);
if (!Number.isInteger(postId) || !Number.isFinite(postId) || postId <= 0) {
this.transitionTo('error404', 'editor/' + params.post_id);
if (!_.isNumber(postId) || !_.isFinite(postId) || postId % 1 !== 0 || postId <= 0) {
return this.transitionTo('error404', 'editor/' + params.post_id);
}
post = this.store.getById('post', postId);

View File

@ -9,8 +9,9 @@ var PostsPostRoute = Ember.Route.extend(Ember.SimpleAuth.AuthenticatedRouteMixin
postId = Number(params.post_id);
if (!Number.isInteger(postId) || !Number.isFinite(postId) || postId <= 0) {
this.transitionTo('error404', params.post_id);
if (!_.isNumber(postId) || !_.isFinite(postId) || postId % 1 !== 0 || postId <= 0)
{
return this.transitionTo('error404', params.post_id);
}
post = this.store.getById('post', postId);