From bd397b6de06cbc5521073613a3c2ee4cb41c3820 Mon Sep 17 00:00:00 2001 From: jpirnay Date: Wed, 13 May 2026 22:48:46 +0200 Subject: [PATCH] Fix oversight --- lib/FsHelpers/FsHelpers.h | 6 ++++++ src/network/CrossPointWebServer.cpp | 14 +++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/lib/FsHelpers/FsHelpers.h b/lib/FsHelpers/FsHelpers.h index b1aa0c41..575be23e 100644 --- a/lib/FsHelpers/FsHelpers.h +++ b/lib/FsHelpers/FsHelpers.h @@ -49,6 +49,9 @@ inline bool hasEpubExtension(const String& fileName) { // Check for either .xtc or .xtch extension (case-insensitive) bool hasXtcExtension(std::string_view fileName); +inline bool hasXtcExtension(const String& fileName) { + return hasXtcExtension(std::string_view{fileName.c_str(), fileName.length()}); +} // Check for .txt extension (case-insensitive) bool hasTxtExtension(std::string_view fileName); @@ -58,5 +61,8 @@ inline bool hasTxtExtension(const String& fileName) { // Check for .md extension (case-insensitive) bool hasMarkdownExtension(std::string_view fileName); +inline bool hasMarkdownExtension(const String& fileName) { + return hasMarkdownExtension(std::string_view{fileName.c_str(), fileName.length()}); +} } // namespace FsHelpers diff --git a/src/network/CrossPointWebServer.cpp b/src/network/CrossPointWebServer.cpp index c588cb4d..15f3e9e9 100644 --- a/src/network/CrossPointWebServer.cpp +++ b/src/network/CrossPointWebServer.cpp @@ -858,7 +858,7 @@ void CrossPointWebServer::handleUpload(UploadState& state) const { String filePath = state.path; if (!filePath.endsWith("/")) filePath += "/"; filePath += state.fileName; - clearEpubCacheIfNeeded(filePath); + clearBookCacheIfNeeded(filePath); } } } else if (upload.status == UPLOAD_FILE_ABORTED) { @@ -1001,9 +1001,9 @@ void CrossPointWebServer::handleRename() const { } if (isDir) { - clearEpubCachesInDirectory(itemPath); + clearBookCachesInDirectory(itemPath); } else { - clearEpubCacheIfNeeded(itemPath); + clearBookCacheIfNeeded(itemPath); } const bool success = file.rename(newPath.c_str()); file.close(); @@ -1099,9 +1099,9 @@ void CrossPointWebServer::handleMove() const { } if (isDir) { - clearEpubCachesInDirectory(itemPath); + clearBookCachesInDirectory(itemPath); } else { - clearEpubCacheIfNeeded(itemPath); + clearBookCacheIfNeeded(itemPath); } const bool success = file.rename(newPath.c_str()); file.close(); @@ -2408,7 +2408,7 @@ void CrossPointWebServer::onWebSocketEvent(uint8_t num, WStype_t type, uint8_t* wsLastCompleteSize = 0; wsLastCompleteAt = millis(); LOG_DBG("WS", "Zero-byte upload complete: %s", filePath.c_str()); - clearEpubCacheIfNeeded(filePath); + clearBookCacheIfNeeded(filePath); wsServer->sendTXT(num, "DONE"); wsLastProgressSent = 0; break; @@ -2476,7 +2476,7 @@ void CrossPointWebServer::onWebSocketEvent(uint8_t num, WStype_t type, uint8_t* String filePath = wsUploadPath; if (!filePath.endsWith("/")) filePath += "/"; filePath += wsUploadFileName; - clearEpubCacheIfNeeded(filePath); + clearBookCacheIfNeeded(filePath); wsServer->sendTXT(num, "DONE"); wsLastProgressSent = 0;