mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-08-11 02:42:27 +08:00
server: Add comment to clarify use of regex
This commit is contained in:
parent
7f17f93767
commit
c2baa4b752
@ -61,6 +61,7 @@ async function exportToZip(taskContext: TaskContext, branch: BBranch, format: "h
|
|||||||
|
|
||||||
// Crop fileName to avoid its length exceeding 30 and prevent cutting into the extension.
|
// Crop fileName to avoid its length exceeding 30 and prevent cutting into the extension.
|
||||||
if (fileName.length > 30) {
|
if (fileName.length > 30) {
|
||||||
|
// We use regex to match the extension to preserve multiple dots in extensions (e.g. .tar.gz).
|
||||||
let match = fileName.match(/(\.[a-zA-Z0-9_.!#-]+)$/);
|
let match = fileName.match(/(\.[a-zA-Z0-9_.!#-]+)$/);
|
||||||
let ext = match ? match[0] : '';
|
let ext = match ? match[0] : '';
|
||||||
// Crop the extension if extension length exceeds 30
|
// Crop the extension if extension length exceeds 30
|
||||||
|
Loading…
x
Reference in New Issue
Block a user