瀏覽代碼

Do not mix raw and cooked lengths for trimming logic

Alois Mahdal 9 年之前
父節點
當前提交
2401bdaa6a
共有 1 個檔案被更改,包括 1 行新增1 行删除
  1. 1
    1
      include/sardine.py

+ 1
- 1
include/sardine.py 查看文件

@@ -129,7 +129,7 @@ class Subcommand(object):
129 129
         suffix = u'…'
130 130
         cooked = raw.decode("utf-8")
131 131
         if self.plugindata.fmt == "plain":
132
-            if self.plugindata.maxlen and len(raw) > self.plugindata.maxlen:
132
+            if self.plugindata.maxlen and len(cooked) > self.plugindata.maxlen:
133 133
                 newlen = self.plugindata.maxlen - len(suffix)
134 134
                 cooked = cooked[:newlen] + suffix
135 135
         return cooked.encode("utf-8")