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

Clipper: Fixes #1600: Handle SVG images and fix issue with invalid file extensions

This commit is contained in:
Laurent Cozic
2019-06-12 09:45:31 +01:00
parent d6218f35fe
commit ad211b4b4e
3 changed files with 29 additions and 3 deletions

View File

@ -37,9 +37,10 @@ function isHidden(path) {
return b[0] === '.';
}
function safeFileExtension(e) {
function safeFileExtension(e, maxLength = null) {
if (maxLength === null) maxLength = 8;
if (!e || !e.replace) return '';
return e.replace(/[^a-zA-Z0-9]/g, '')
return e.replace(/[^a-zA-Z0-9]/g, '').substr(0, maxLength);
}
function safeFilename(e, maxLength = null, allowSpaces = false) {