Sanitize /upload/search/:q route (#8658)

Signed-off-by: Convly <jean-sebastien.herbaux@epitech.eu>
This commit is contained in:
Jean-Sébastien Herbaux 2020-11-16 12:55:35 +01:00 committed by GitHub
parent d3c249c876
commit 4a33829f11
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,6 +8,7 @@
const _ = require('lodash');
const apiUploadController = require('./upload/api');
const adminUploadController = require('./upload/admin');
const { sanitizeEntity } = require('strapi-utils');
const resolveController = ctx => {
const {
@ -66,10 +67,12 @@ module.exports = {
async search(ctx) {
const { id } = ctx.params;
ctx.body = await strapi.query('file', 'upload').custom(searchQueries)({
const model = strapi.getModel('file', 'upload');
const entries = await strapi.query('file', 'upload').custom(searchQueries)({
id,
});
ctx.body = sanitizeEntity(entries, { model });
},
};