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

[FIX] Change JSON to EJSON.parse query to support type Date #12706

Merged
merged 2 commits into from
Dec 20, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/rocketchat-api/server/helpers/parseJsonQuery.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Meteor } from 'meteor/meteor';
import { RocketChat } from 'meteor/rocketchat:lib';
import { EJSON } from 'meteor/ejson';

RocketChat.API.helperMethods.set('parseJsonQuery', function _parseJsonQuery() {
let sort;
Expand Down Expand Up @@ -50,7 +51,7 @@ RocketChat.API.helperMethods.set('parseJsonQuery', function _parseJsonQuery() {
let query = {};
if (this.queryParams.query) {
try {
query = JSON.parse(this.queryParams.query);
query = EJSON.parse(this.queryParams.query);
} catch (e) {
this.logger.warn(`Invalid query parameter provided "${ this.queryParams.query }":`, e);
throw new Meteor.Error('error-invalid-query', `Invalid query parameter provided: "${ this.queryParams.query }"`, { helperMethod: 'parseJsonQuery' });
Expand Down