From 4ce7f3ed46511812db79bc92867dca5e1c0809d4 Mon Sep 17 00:00:00 2001 From: Arthur Tazhitdinov Date: Thu, 22 Jan 2026 21:37:04 +0500 Subject: [PATCH] refactor: simplify isTxtFile method to use StringUtils for extension checking --- src/activities/reader/ReaderActivity.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/activities/reader/ReaderActivity.cpp b/src/activities/reader/ReaderActivity.cpp index 83c54042..04240b3c 100644 --- a/src/activities/reader/ReaderActivity.cpp +++ b/src/activities/reader/ReaderActivity.cpp @@ -22,9 +22,8 @@ bool ReaderActivity::isXtcFile(const std::string& path) { } bool ReaderActivity::isTxtFile(const std::string& path) { - if (path.length() < 4) return false; - std::string ext4 = path.substr(path.length() - 4); - return ext4 == ".txt" || ext4 == ".TXT" || ext4 == ".md" || ext4 == ".MD"; // Treat .md as txt files (until we have a markdown reader) + return StringUtils::checkFileExtension(path, ".txt") || + StringUtils::checkFileExtension(path, ".md"); // Treat .md as txt files (until we have a markdown reader) } std::unique_ptr ReaderActivity::loadEpub(const std::string& path) {