diff --git a/web/documentserver-example/nodejs/helpers/fileUtility.js b/web/documentserver-example/nodejs/helpers/fileUtility.js index f69563ff..6587df46 100644 --- a/web/documentserver-example/nodejs/helpers/fileUtility.js +++ b/web/documentserver-example/nodejs/helpers/fileUtility.js @@ -17,6 +17,7 @@ */ const supportedFormats = require('../public/assets/document-formats/onlyoffice-docs-formats.json'); // eslint-disable-line +const pathModule = require('path'); const fileUtility = {}; @@ -39,8 +40,7 @@ fileUtility.getFileNameFromUrl = function getFileNameFromUrl(url, withoutExtensi fileUtility.getFileName = function getFileName(path, withoutExtension) { if (!path) return ''; - const parts = path.split('/'); - const fileName = parts.pop(); // get the file name from the last part of the path + const fileName = pathModule.basename(path); // get the file name from the last part of the path // get file name without extension if (withoutExtension) {