Skip to content
This repository has been archived by the owner on Jan 6, 2023. It is now read-only.

Commit

Permalink
Make filenames truncate at 200 characters (#768)
Browse files Browse the repository at this point in the history
Fixes #766
  • Loading branch information
vladikoff committed Mar 16, 2018
1 parent ebdd6a9 commit 5786932
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/sidebar/app/utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function getFirstNonEmptyElement(parentElement) {
/**
* Formats the filename for the "Export as HTML..." menu option.
* Whitespace and illegal filename characters are removed, and
* the length is shortened if longer than 250 characters.
* the length is shortened if longer than 200 characters.
* @param {string} filename
* @returns {string}
*/
Expand All @@ -41,8 +41,8 @@ function formatFilename(filename) {
formattedFilename = formattedFilename.trim();
// remove illegal filename characters
formattedFilename = formattedFilename.replace(/[~#%{}[\]:\\<>/!@&?"*.+|\n\r\t]/g, '');
if (formattedFilename.length > 250) { // 255 bytes (filesystem max) - 5 for ".html" extension
formattedFilename = formattedFilename.substring(0, 250);
if (formattedFilename.length > 200) { // 200 bytes (close to filesystem max) - 5 for ".html" extension
formattedFilename = formattedFilename.substring(0, 200);
}
return `${formattedFilename}.html`;
}
Expand Down

0 comments on commit 5786932

Please sign in to comment.