Merge pull request #612 from strapi/fix-fetch-error-mongoose

Fix fetch error mongoose
This commit is contained in:
Jim LAURIE 2018-02-09 16:47:44 +01:00 committed by GitHub
commit 832883a91b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -28,6 +28,10 @@ module.exports = {
*/
findOne: async (ctx) => {
if (!ctx.params._id.match(/^[0-9a-fA-F]{24}$/)) {
return ctx.notFound();
}
const data = await strapi.services.<%= id %>.fetch(ctx.params);
// Send 200 `ok`