mirror of
https://github.com/laurent22/joplin.git
synced 2025-02-01 19:15:01 +02:00
All: Fixes #3696: Increased file extension limit to 20 to prevent issue when using external editors
This commit is contained in:
parent
07ab0e986d
commit
c84e49c71c
@ -40,7 +40,12 @@ function isHidden(path) {
|
||||
}
|
||||
|
||||
function safeFileExtension(e, maxLength = null) {
|
||||
if (maxLength === null) maxLength = 8;
|
||||
// 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.
|
||||
// Note that it means that a file extension longer than 20 will break
|
||||
// external editing (since the extension would be truncated).
|
||||
// https://discourse.joplinapp.org/t/troubles-with-webarchive-files-on-ios/10447
|
||||
if (maxLength === null) maxLength = 20;
|
||||
if (!e || !e.replace) return '';
|
||||
return e.replace(/[^a-zA-Z0-9]/g, '').substr(0, maxLength);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user