Fix book handler showing old cache when replace_single_newlines changed

This commit is contained in:
Deniz Şafak
2025-10-27 18:27:07 +03:00
parent 4cef65e70e
commit e4fe8122ff
+7 -2
View File
@@ -366,13 +366,18 @@ class HandlerDialog(QDialog):
def _preprocess_content(self):
"""Pre-process content from the document"""
# Create cache key from file path, modification time, and file type
# Create cache key from file path, modification time, file type, and replace_single_newlines setting
try:
mod_time = os.path.getmtime(self.book_path)
except Exception:
mod_time = 0
cache_key = (self.book_path, mod_time, self.file_type)
# Include replace_single_newlines in cache key since it affects text cleaning
from abogen.utils import load_config
cfg = load_config()
replace_single_newlines = cfg.get("replace_single_newlines", False)
cache_key = (self.book_path, mod_time, self.file_type, replace_single_newlines)
# Check if content is already cached
if cache_key in HandlerDialog._content_cache: