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

Issue #8020: Disabled autoPopulate for File model (upload plugin) #10370

Merged
merged 4 commits into from
Jun 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/strapi-plugin-upload/controllers/upload/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ module.exports = {
const method = _.has(ctx.query, '_q') ? 'search' : 'fetchAll';

const query = pm.queryFrom(ctx.query);
const files = await strapi.plugins.upload.services.upload[method](query);
const files = await strapi.plugins.upload.services.upload[method](query, []);

ctx.body = pm.sanitize(files, { withPrivate: false });
},
Expand Down Expand Up @@ -191,7 +191,7 @@ module.exports = {
};

const findEntityAndCheckPermissions = async (ability, action, model, id) => {
const file = await strapi.plugins.upload.services.upload.fetch({ id });
const file = await strapi.plugins.upload.services.upload.fetch({ id }, []);

if (_.isNil(file)) {
throw strapi.errors.notFound();
Expand Down
12 changes: 6 additions & 6 deletions packages/strapi-plugin-upload/services/Upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,17 +305,17 @@ module.exports = {
return res;
},

fetch(params) {
return strapi.query('file', 'upload').findOne(params);
fetch(params, populate) {
return strapi.query('file', 'upload').findOne(params, populate);
},

fetchAll(params) {
fetchAll(params, populate) {
combineFilters(params);
return strapi.query('file', 'upload').find(params);
return strapi.query('file', 'upload').find(params, populate);
},

search(params) {
return strapi.query('file', 'upload').search(params);
search(params, populate) {
return strapi.query('file', 'upload').search(params, populate);
},

countSearch(params) {
Expand Down