From ada17c99f746c397317411d48c59722b2a5ebf29 Mon Sep 17 00:00:00 2001 From: sshakndr Date: Fri, 6 Feb 2026 17:39:09 +0700 Subject: [PATCH] fix(nodejs): use path module to get file basename. Fix Bug 79810 --- web/documentserver-example/nodejs/helpers/fileUtility.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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) {