Skip to content

Commit

Permalink
nodejs: replace unsupported symbols in file name
Browse files Browse the repository at this point in the history
  • Loading branch information
LinneyS committed Sep 10, 2024
1 parent f55beaa commit 4ae4687
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion web/documentserver-example/nodejs/helpers/docManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ DocManager.prototype.getCustomParams = function getCustomParams() {
DocManager.prototype.getCorrectName = function getCorrectName(fileName, userAddress) {
// get file name from the url without extension
const maxName = configServer.get('maxNameLength');
const baseName = fileUtility.getFileName(fileName, true).substr(0, maxName)
let baseName = fileUtility.getFileName(fileName, true);
baseName = baseName.replace(/[/\\?%*:|"<>]/g, '_').substr(0, maxName)
+ (fileName.length > maxName ? '[...]' : '');
const ext = fileUtility.getFileExtension(fileName); // get file extension from the url
let name = baseName + ext; // get full file name
Expand Down

0 comments on commit 4ae4687

Please sign in to comment.