mirror of
https://github.com/ONLYOFFICE/document-server-integration.git
synced 2026-02-10 18:05:10 +08:00
fix(nodejs): use path module to get file basename. Fix Bug 79810
This commit is contained in:
@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user