From a20e20aae00761ca2c71cb51f60efab0d5c17e45 Mon Sep 17 00:00:00 2001 From: jpirnay Date: Fri, 8 May 2026 23:44:07 +0200 Subject: [PATCH] Guard extension split to filename only --- src/activities/reader/ReaderActivity.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/activities/reader/ReaderActivity.cpp b/src/activities/reader/ReaderActivity.cpp index e115391b..0d12c201 100644 --- a/src/activities/reader/ReaderActivity.cpp +++ b/src/activities/reader/ReaderActivity.cpp @@ -57,8 +57,9 @@ bool ReaderActivity::isImageFile(const std::string& path) { } std::string ReaderActivity::sidecarCoverPath(const std::string& bookPath) { + const auto sep = bookPath.find_last_of("/\\"); const auto dot = bookPath.rfind('.'); - if (dot == std::string::npos) return ""; + if (dot == std::string::npos || (sep != std::string::npos && dot < sep)) return ""; const std::string base = bookPath.substr(0, dot); for (const char* ext : {".jpg", ".jpeg", ".png", ".bmp"}) { const std::string candidate = base + ext;