server: Trim .htm when importing zip (closes #500)

This commit is contained in:
Elian Doran 2024-10-20 00:17:51 +03:00
parent d4956ad3a2
commit 4ad725842e
No known key found for this signature in database

View File

@ -219,10 +219,13 @@ function formatDownloadTitle(fileName: string, type: string | null, mime: string
function removeTextFileExtension(filePath: string) {
const extension = path.extname(filePath).toLowerCase();
if (extension === '.md' || extension === '.markdown' || extension === '.html') {
switch (extension) {
case ".md":
case ".markdown":
case ".html":
case ".htm":
return filePath.substr(0, filePath.length - extension.length);
}
else {
default:
return filePath;
}
}