Skip to content

Commit

Permalink
server: Add comment to clarify use of regex
Browse files Browse the repository at this point in the history
  • Loading branch information
eliandoran committed Nov 1, 2024
1 parent 7f17f93 commit c2baa4b
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/services/export/zip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
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 ext = match ? match[0] : '';
// Crop the extension if extension length exceeds 30
Expand Down

0 comments on commit c2baa4b

Please sign in to comment.