1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-11-23 22:36:32 +02:00

Desktop, Cli: Fixes #9548: Import ENEX archives that contain files with invalid names

This commit is contained in:
Laurent Cozic
2023-12-24 11:24:48 +00:00
parent cec5f1f3ba
commit bf907f21c4
4 changed files with 48 additions and 2 deletions

View File

@@ -39,6 +39,9 @@ export function isHidden(path: string) {
return b[0] === '.';
}
// Note that this function only sanitizes a file extension - it does NOT extract
// the file extension from a filename. So the way you'd normally call this is
// `safeFileExtension(fileExtension(filename))`
export function safeFileExtension(e: string, maxLength: number = null) {
// In theory the file extension can have any length but in practice Joplin
// expects a fixed length, so we limit it to 20 which should cover most cases.