From 4a1d08c653070e856bceb1bc4a7d8ff7ab1aa203 Mon Sep 17 00:00:00 2001 From: Wu Cheng-Han Date: Wed, 15 Mar 2017 22:12:24 +0800 Subject: [PATCH] Fix strip null byte in model should cast to string to use replace function --- lib/models/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/models/index.js b/lib/models/index.js index a378ee6..95f900b 100644 --- a/lib/models/index.js +++ b/lib/models/index.js @@ -23,6 +23,7 @@ if (config.dburl) { // [Postgres] Handling NULL bytes // https://github.com/sequelize/sequelize/issues/6485 function stripNullByte (value) { + value = '' + value return value ? value.replace(/\u0000/g, '') : value } sequelize.stripNullByte = stripNullByte