Fixed determining file extension.

This commit is contained in:
SamTV12345 2024-01-18 22:37:57 +01:00
parent eef3b9e924
commit 72dc6227ab

View file

@ -114,7 +114,7 @@ const doImport = async (req, res, padId, authorId) => {
// ensure this is a file ending we know, else we change the file ending to .txt // ensure this is a file ending we know, else we change the file ending to .txt
// this allows us to accept source code files like .c or .java // this allows us to accept source code files like .c or .java
const fileEnding = path.extname(srcFile).toLowerCase(); const fileEnding = path.extname(files.file[0].originalFilename).toLowerCase();
const knownFileEndings = const knownFileEndings =
['.txt', '.doc', '.docx', '.pdf', '.odt', '.html', '.htm', '.etherpad', '.rtf']; ['.txt', '.doc', '.docx', '.pdf', '.odt', '.html', '.htm', '.etherpad', '.rtf'];
const fileEndingUnknown = (knownFileEndings.indexOf(fileEnding) < 0); const fileEndingUnknown = (knownFileEndings.indexOf(fileEnding) < 0);