Skip to content
This repository was archived by the owner on Sep 16, 2025. It is now read-only.

Commit f27ce29

Browse files
fix(slugController): sanitize response (#19)
1 parent 2afe711 commit f27ce29

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

server/controllers/slug-controller.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
'use strict';
22

33
const _ = require('lodash');
4+
const { sanitize } = require('@strapi/utils');
45
const { getPluginService } = require('../utils/getPluginService');
56
const { transformResponse } = require('@strapi/strapi/lib/core-api/controller/transform');
67

@@ -43,7 +44,8 @@ module.exports = ({ strapi }) => ({
4344
const data = await getPluginService(strapi, 'slugService').findOne(uid, query);
4445

4546
if (data) {
46-
ctx.body = transformResponse(data);
47+
const sanitizedEntity = await sanitize.contentAPI.output(data, contentType);
48+
ctx.body = transformResponse(sanitizedEntity);
4749
} else {
4850
ctx.notFound();
4951
}

0 commit comments

Comments
 (0)