ソースを参照

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
         suffix = u'…'
129
         suffix = u'…'
130
         cooked = raw.decode("utf-8")
130
         cooked = raw.decode("utf-8")
131
         if self.plugindata.fmt == "plain":
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
                 newlen = self.plugindata.maxlen - len(suffix)
133
                 newlen = self.plugindata.maxlen - len(suffix)
134
                 cooked = cooked[:newlen] + suffix
134
                 cooked = cooked[:newlen] + suffix
135
         return cooked.encode("utf-8")
135
         return cooked.encode("utf-8")