From 48fb6fc46f9545b9dd9663a4527c306f475c70fe Mon Sep 17 00:00:00 2001 From: tianshujie Date: Sun, 26 Sep 2021 17:23:55 +0800 Subject: [PATCH] * Finish task #42861. --- module/execution/js/create.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/module/execution/js/create.js b/module/execution/js/create.js index 42447b04e2..6c4ed4fc0d 100644 --- a/module/execution/js/create.js +++ b/module/execution/js/create.js @@ -120,7 +120,13 @@ function subString(title, lengthOfTitle) var length = 0; for(var i = 0; i < title.length; i ++) { - title.charCodeAt(i) > 255 ? length += 2 : length += 1; - if(length > lengthOfTitle) return title.substring(0, i) + '...'; + length += title.charCodeAt(i) > 255 ? 2 : 1; + if(length > lengthOfTitle) + { + title = title.substring(0, i) + '...'; + break; + } } + + return title; }