Guard extension split to filename only

This commit is contained in:
jpirnay
2026-05-08 23:44:07 +02:00
parent 08ddc4e481
commit a20e20aae0
+2 -1
View File
@@ -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;