File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -173,14 +173,15 @@ def handle_toc(doc, limit):
173
173
174
174
# Null characters are not allowed.
175
175
chapter_text = chapter_text .replace ('\0 ' , '' )
176
-
176
+ # 限制标题长度
177
+ real_chapter_title = chapter_title [:256 ]
177
178
# 限制章节内容长度
178
179
if 0 < limit < len (chapter_text ):
179
180
split_text = PdfSplitHandle .split_text (chapter_text , limit )
180
181
for text in split_text :
181
- chapters .append ({"title" : chapter_title , "content" : text })
182
+ chapters .append ({"title" : real_chapter_title , "content" : text })
182
183
else :
183
- chapters .append ({"title" : chapter_title , "content" : chapter_text if chapter_text else chapter_title })
184
+ chapters .append ({"title" : real_chapter_title , "content" : chapter_text if chapter_text else real_chapter_title })
184
185
# 保存章节内容和章节标题
185
186
return chapters
186
187
You can’t perform that action at this time.
0 commit comments