Merge pull request #74 from jjeejj/master

fix middleware/utf8.js file bug
This commit is contained in:
DIYgod 2018-05-05 10:44:43 +08:00 committed by GitHub
commit 06c74ea075
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -2,5 +2,5 @@
// https://stackoverflow.com/questions/1497885/remove-control-characters-from-php-string/1497928#1497928
module.exports = async (ctx, next) => {
await next();
ctx.body = ctx.body.replace(/[\x00-\x1F\x7F]/g, '');
ctx.body = ctx.body?ctx.body.replace(/[\x00-\x1F\x7F]/g, ''):ctx.body;
};