Fix oversight
This commit is contained in:
@@ -49,6 +49,9 @@ inline bool hasEpubExtension(const String& fileName) {
|
|||||||
|
|
||||||
// Check for either .xtc or .xtch extension (case-insensitive)
|
// Check for either .xtc or .xtch extension (case-insensitive)
|
||||||
bool hasXtcExtension(std::string_view fileName);
|
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)
|
// Check for .txt extension (case-insensitive)
|
||||||
bool hasTxtExtension(std::string_view fileName);
|
bool hasTxtExtension(std::string_view fileName);
|
||||||
@@ -58,5 +61,8 @@ inline bool hasTxtExtension(const String& fileName) {
|
|||||||
|
|
||||||
// Check for .md extension (case-insensitive)
|
// Check for .md extension (case-insensitive)
|
||||||
bool hasMarkdownExtension(std::string_view fileName);
|
bool hasMarkdownExtension(std::string_view fileName);
|
||||||
|
inline bool hasMarkdownExtension(const String& fileName) {
|
||||||
|
return hasMarkdownExtension(std::string_view{fileName.c_str(), fileName.length()});
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace FsHelpers
|
} // namespace FsHelpers
|
||||||
|
|||||||
@@ -858,7 +858,7 @@ void CrossPointWebServer::handleUpload(UploadState& state) const {
|
|||||||
String filePath = state.path;
|
String filePath = state.path;
|
||||||
if (!filePath.endsWith("/")) filePath += "/";
|
if (!filePath.endsWith("/")) filePath += "/";
|
||||||
filePath += state.fileName;
|
filePath += state.fileName;
|
||||||
clearEpubCacheIfNeeded(filePath);
|
clearBookCacheIfNeeded(filePath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (upload.status == UPLOAD_FILE_ABORTED) {
|
} else if (upload.status == UPLOAD_FILE_ABORTED) {
|
||||||
@@ -1001,9 +1001,9 @@ void CrossPointWebServer::handleRename() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isDir) {
|
if (isDir) {
|
||||||
clearEpubCachesInDirectory(itemPath);
|
clearBookCachesInDirectory(itemPath);
|
||||||
} else {
|
} else {
|
||||||
clearEpubCacheIfNeeded(itemPath);
|
clearBookCacheIfNeeded(itemPath);
|
||||||
}
|
}
|
||||||
const bool success = file.rename(newPath.c_str());
|
const bool success = file.rename(newPath.c_str());
|
||||||
file.close();
|
file.close();
|
||||||
@@ -1099,9 +1099,9 @@ void CrossPointWebServer::handleMove() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isDir) {
|
if (isDir) {
|
||||||
clearEpubCachesInDirectory(itemPath);
|
clearBookCachesInDirectory(itemPath);
|
||||||
} else {
|
} else {
|
||||||
clearEpubCacheIfNeeded(itemPath);
|
clearBookCacheIfNeeded(itemPath);
|
||||||
}
|
}
|
||||||
const bool success = file.rename(newPath.c_str());
|
const bool success = file.rename(newPath.c_str());
|
||||||
file.close();
|
file.close();
|
||||||
@@ -2408,7 +2408,7 @@ void CrossPointWebServer::onWebSocketEvent(uint8_t num, WStype_t type, uint8_t*
|
|||||||
wsLastCompleteSize = 0;
|
wsLastCompleteSize = 0;
|
||||||
wsLastCompleteAt = millis();
|
wsLastCompleteAt = millis();
|
||||||
LOG_DBG("WS", "Zero-byte upload complete: %s", filePath.c_str());
|
LOG_DBG("WS", "Zero-byte upload complete: %s", filePath.c_str());
|
||||||
clearEpubCacheIfNeeded(filePath);
|
clearBookCacheIfNeeded(filePath);
|
||||||
wsServer->sendTXT(num, "DONE");
|
wsServer->sendTXT(num, "DONE");
|
||||||
wsLastProgressSent = 0;
|
wsLastProgressSent = 0;
|
||||||
break;
|
break;
|
||||||
@@ -2476,7 +2476,7 @@ void CrossPointWebServer::onWebSocketEvent(uint8_t num, WStype_t type, uint8_t*
|
|||||||
String filePath = wsUploadPath;
|
String filePath = wsUploadPath;
|
||||||
if (!filePath.endsWith("/")) filePath += "/";
|
if (!filePath.endsWith("/")) filePath += "/";
|
||||||
filePath += wsUploadFileName;
|
filePath += wsUploadFileName;
|
||||||
clearEpubCacheIfNeeded(filePath);
|
clearBookCacheIfNeeded(filePath);
|
||||||
|
|
||||||
wsServer->sendTXT(num, "DONE");
|
wsServer->sendTXT(num, "DONE");
|
||||||
wsLastProgressSent = 0;
|
wsLastProgressSent = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user