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

pull/520/head
Elian Doran 2024-10-20 00:17:51 +07:00
parent d4956ad3a2
commit 4ad725842e
No known key found for this signature in database
1 changed files with 8 additions and 5 deletions

@ -219,11 +219,14 @@ 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') {
return filePath.substr(0, filePath.length - extension.length);
}
else {
return filePath;
switch (extension) {
case ".md":
case ".markdown":
case ".html":
case ".htm":
return filePath.substr(0, filePath.length - extension.length);
default:
return filePath;
}
}