Fix oversight

This commit is contained in:
jpirnay
2026-05-13 22:48:46 +02:00
parent 4090076506
commit bd397b6de0
2 changed files with 13 additions and 7 deletions
+6
View File
@@ -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
+7 -7
View File
@@ -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;