diff --git a/web/documentserver-example/nodejs/app.js b/web/documentserver-example/nodejs/app.js index 3ab2a8a4..9c8d360e 100755 --- a/web/documentserver-example/nodejs/app.js +++ b/web/documentserver-example/nodejs/app.js @@ -100,9 +100,9 @@ app.get('/', (req, res) => { // define a handler for default page res.render('index', { // render index template with the parameters specified preloaderUrl: siteUrl + configServer.get('preloaderUrl'), - convertExts: configServer.get('convertedDocs'), - editedExts: configServer.get('editedDocs'), - fillExts: configServer.get('fillDocs'), + convertExts: fileUtility.getConvertExtensions(), + editedExts: fileUtility.getEditExtensions(), + fillExts: fileUtility.getFillExtensions(), storedFiles: req.DocManager.getStoredFiles(), params: req.DocManager.getCustomParams(), users, @@ -240,13 +240,8 @@ app.post('/upload', (req, res) => { // define a handler for uploading files return; } - const exts = [].concat( - configServer.get('viewedDocs'), - configServer.get('editedDocs'), - configServer.get('convertedDocs'), - configServer.get('fillDocs'), - ); // all the supported file extensions - const curExt = fileUtility.getFileExtension(file.name); + const exts = fileUtility.getSuppotredExtensions(); // all the supported file extensions + const curExt = fileUtility.getFileExtension(file.name, true); const documentType = fileUtility.getFileType(file.name); if (exts.indexOf(curExt) === -1) { // check if the file extension is supported @@ -297,13 +292,8 @@ app.post('/create', (req, res) => { return; } - const exts = [].concat( - configServer.get('viewedDocs'), - configServer.get('editedDocs'), - configServer.get('convertedDocs'), - configServer.get('fillDocs'), - ); // all the supported file extensions - const curExt = fileUtility.getFileExtension(fileName); + const exts = fileUtility.getSuppotredExtensions(); // all the supported file extensions + const curExt = fileUtility.getFileExtension(fileName, true); if (exts.indexOf(curExt) === -1) { // check if the file extension is supported // and write the error status and message to the response @@ -336,7 +326,7 @@ app.post('/convert', (req, res) => { // define a handler for converting files const filePass = req.body.filePass ? req.body.filePass : null; const lang = req.body.lang ? req.body.lang : null; const fileUri = req.DocManager.getDownloadUrl(fileName, true); - const fileExt = fileUtility.getFileExtension(fileName); + const fileExt = fileUtility.getFileExtension(fileName,true); const internalFileExt = 'ooxml'; const response = res; @@ -409,7 +399,7 @@ app.post('/convert', (req, res) => { // define a handler for converting files try { // check if the file with such an extension can be converted - if (configServer.get('convertedDocs').indexOf(fileExt) !== -1) { + if (fileUtility.getConvertExtensions().indexOf(fileExt) !== -1) { const storagePath = req.DocManager.storagePath(fileName); const stat = fileSystem.statSync(storagePath); let key = fileUri + stat.mtime.getTime(); @@ -917,9 +907,9 @@ app.get('/editor', (req, res) => { // define a handler for editing document const directUrl = req.DocManager.getDownloadUrl(fileName); let mode = req.query.mode || 'edit'; // mode: view/edit/review/comment/fillForms/embedded - let canEdit = configServer.get('editedDocs').indexOf(fileExt) !== -1; // check if this file can be edited + let canEdit = fileUtility.getEditExtensions().indexOf(fileExt.slice(1)) !== -1; // check if this file can be edited if (((!canEdit && mode === 'edit') || mode === 'fillForms') - && configServer.get('fillDocs').indexOf(fileExt) !== -1) { + && fileUtility.getFillExtensions().indexOf(fileExt.slice(1)) !== -1) { mode = 'fillForms'; canEdit = true; } diff --git a/web/documentserver-example/nodejs/config/default.json b/web/documentserver-example/nodejs/config/default.json index dd138d5d..624cf071 100644 --- a/web/documentserver-example/nodejs/config/default.json +++ b/web/documentserver-example/nodejs/config/default.json @@ -22,10 +22,6 @@ "apiUrl": "web-apps/apps/api/documents/api.js", "preloaderUrl": "web-apps/apps/api/documents/cache-scripts.html", "exampleUrl": null, - "viewedDocs": [".djvu", ".oxps", ".pdf", ".xps"], - "editedDocs": [".csv", ".docm", ".docx", ".docxf", ".dotm", ".dotx", ".epub", ".fb2", ".html", ".odp", ".ods", ".odt", ".otp", ".ots", ".ott", ".potm", ".potx", ".ppsm", ".ppsx", ".pptm", ".pptx", ".rtf", ".txt", ".xlsm", ".xlsx", ".xltm", ".xltx"], - "fillDocs": [".docx", ".oform"], - "convertedDocs": [".doc", ".dot", ".dps", ".dpt", ".epub", ".et", ".ett", ".fb2", ".fodp", ".fods", ".fodt", ".htm", ".html", ".mht", ".mhtml", ".odp", ".ods", ".odt", ".otp", ".ots", ".ott", ".pot", ".pps", ".ppt", ".rtf", ".stw", ".sxc", ".sxi", ".sxw", ".wps", ".wpt", ".xls", ".xlsb", ".xlt", ".xml"], "storageFolder": "./files", "storagePath": "/files", "maxFileSize": 1073741824, diff --git a/web/documentserver-example/nodejs/config/onlyoffice-docs-formats.json b/web/documentserver-example/nodejs/config/onlyoffice-docs-formats.json new file mode 100644 index 00000000..0255618b --- /dev/null +++ b/web/documentserver-example/nodejs/config/onlyoffice-docs-formats.json @@ -0,0 +1,401 @@ +[ + { + "name": "djvu", + "type": "word", + "actions": ["view"], + "convert": [], + "mime": "image/vnd.djvu" + }, + { + "name": "doc", + "type": "word", + "actions": ["view", "edit"], + "convert": ["docx", "docxf", "docm", "dotx", "dotm", "epub", "fb2", "html", "odt", "ott", "pdf", "pdfa", "rtf", "txt"], + "mime": "application/vnd.ms-word" + }, + { + "name": "docm", + "type": "word", + "actions": ["view", "edit"], + "convert": ["docx", "docxf", "dotx", "dotm", "epub", "fb2", "html", "odt", "ott", "pdf", "pdfa", "rtf", "txt"], + "mime": "application/vnd.ms-word.document.macroEnabled.12" + }, + { + "name": "docx", + "type": "word", + "actions": ["view", "edit", "fill"], + "convert": ["docxf", "docm", "dotx", "dotm", "epub", "fb2", "html", "odt", "ott", "pdf", "pdfa", "rtf", "txt"], + "mime": "application/vnd.openxmlformats-officedocument.wordprocessingml.document" + }, + { + "name": "docxf", + "type": "word", + "actions": ["view", "edit"], + "convert": ["docx", "oform", "docm", "dotx", "dotm", "epub", "fb2", "html", "odt", "ott", "pdf", "pdfa", "rtf", "txt"], + "mime": "application/vnd.openxmlformats-officedocument.wordprocessingml.document.docxf" + }, + { + "name": "oform", + "type": "word", + "actions": ["view", "fill"], + "convert": ["pdf"], + "mime": "application/vnd.openxmlformats-officedocument.wordprocessingml.document.oform" + }, + { + "name": "dot", + "type": "word", + "actions": ["view", "edit"], + "convert": ["docx", "docxf", "docm", "dotx", "dotm", "epub", "fb2", "html", "odt", "ott", "pdf", "pdfa", "rtf", "txt"], + "mime": "application/msword" + }, + { + "name": "dotm", + "type": "word", + "actions": ["view", "edit"], + "convert": ["docx", "docxf", "docm", "dotx", "epub", "fb2", "html", "odt", "ott", "pdf", "pdfa", "rtf", "txt"], + "mime": "application/vnd.ms-word.template.macroEnabled.12" + }, + { + "name": "dotx", + "type": "word", + "actions": ["view", "edit"], + "convert": ["docx", "docxf", "docm", "dotm", "epub", "fb2", "html", "odt", "ott", "pdf", "pdfa", "rtf", "txt"], + "mime": "application/vnd.openxmlformats-officedocument.wordprocessingml.template" + }, + { + "name": "epub", + "type": "word", + "actions": ["view", "lossy-edit"], + "convert": ["docx", "docxf", "docm", "dotx", "dotm", "fb2", "html", "odt", "ott", "pdf", "pdfa", "rtf", "txt"], + "mime": "application/epub+zip" + }, + { + "name": "fb2", + "type": "word", + "actions": ["view", "lossy-edit"], + "convert": ["docx", "docxf", "docm", "dotx", "dotm", "epub", "html", "odt", "ott", "pdf", "pdfa", "rtf", "txt"], + "mime": "text/fb2+xml" + }, + { + "name": "fodt", + "type": "word", + "actions": ["view", "edit"], + "convert": ["docx", "docxf", "docm", "dotx", "dotm", "epub", "fb2", "html", "odt", "ott", "pdf", "pdfa", "rtf", "txt"], + "mime": "application/vnd.oasis.opendocument.text" + }, + { + "name": "htm", + "type": "word", + "actions": ["view", "edit"], + "convert": [], + "mime": null + }, + { + "name": "html", + "type": "word", + "actions": ["view", "lossy-edit"], + "convert": ["docx", "docxf", "docm", "dotx", "dotm", "epub", "fb2", "odt", "ott", "pdf", "pdfa", "rtf", "txt"], + "mime": "text/html" + }, + { + "name": "mht", + "type": "word", + "actions": ["view", "edit"], + "convert": [], + "mime": null + }, + { + "name": "mhtml", + "type": "word", + "actions": ["view", "edit"], + "convert": [], + "mime": null + }, + { + "name": "odt", + "type": "word", + "actions": ["view", "lossy-edit"], + "convert": ["docx", "docxf", "docm", "dotx", "dotm", "epub", "fb2", "html", "ott", "pdf", "pdfa", "rtf", "txt"], + "mime": "application/vnd.oasis.opendocument.text" + }, + { + "name": "ott", + "type": "word", + "actions": ["view", "lossy-edit"], + "convert": ["docx", "docxf", "docm", "dotx", "dotm", "epub", "fb2", "html", "odt", "pdf", "pdfa", "rtf", "txt"], + "mime": "application/vnd.oasis.opendocument.text-template" + }, + { + "name": "oxps", + "type": "word", + "actions": ["view"], + "convert": ["pdf", "pdfa"], + "mime": "application/oxps" + }, + { + "name": "pdf", + "type": "word", + "actions": ["view"], + "convert": [], + "mime": "application/pdf" + }, + { + "name": "rtf", + "type": "word", + "actions": ["view", "lossy-edit"], + "convert": ["docx", "docxf", "docm", "dotx", "dotm", "epub", "fb2", "html", "odt", "ott", "pdf", "pdfa", "txt"], + "mime": "text/rtf" + }, + { + "name": "stw", + "type": "word", + "actions": ["view", "edit"], + "convert": [], + "mime": null + }, + { + "name": "sxw", + "type": "word", + "actions": ["view", "edit"], + "convert": [], + "mime": null + }, + { + "name": "txt", + "type": "word", + "actions": ["view", "lossy-edit"], + "convert": [], + "mime": "text/plain" + }, + { + "name": "wps", + "type": "word", + "actions": ["view", "edit"], + "convert": [], + "mime": null + }, + { + "name": "wpt", + "type": "word", + "actions": ["view", "edit"], + "convert": [], + "mime": null + }, + { + "name": "xps", + "type": "word", + "actions": ["view"], + "convert": ["pdf", "pdfa"], + "mime": "application/vnd.ms-xpsdocument" + }, + { + "name": "xml", + "type": "word", + "actions": ["view", "edit"], + "convert": ["docx", "docxf", "docm", "dotx", "dotm", "epub", "fb2", "html", "odt", "ott", "pdf", "pdfa", "rtf", "txt"], + "mime": "application/xml" + }, + { + "name": "csv", + "type": "cell", + "actions": ["view", "lossy-edit"], + "convert": [], + "mime": "text/csv" + }, + { + "name": "et", + "type": "cell", + "actions": ["view", "edit"], + "convert": [], + "mime": null + }, + { + "name": "ett", + "type": "cell", + "actions": ["view", "edit"], + "convert": [], + "mime": null + }, + { + "name": "fods", + "type": "cell", + "actions": ["view", "edit"], + "convert": ["xlsx", "csv", "ods", "ots", "pdf", "pdfa", "xltx", "xlsm", "xltm"], + "mime": "application/vnd.oasis.opendocument.spreadsheet" + }, + { + "name": "ods", + "type": "cell", + "actions": ["view", "lossy-edit"], + "convert": ["xlsx", "csv", "ots", "pdf", "pdfa", "xltx", "xlsm", "xltm"], + "mime": "application/vnd.oasis.opendocument.spreadsheet" + }, + { + "name": "ots", + "type": "cell", + "actions": ["view", "lossy-edit"], + "convert": ["xlsx", "csv", "ods", "pdf", "pdfa", "xltx", "xlsm", "xltm"], + "mime": "application/vnd.oasis.opendocument.spreadsheet-template" + }, + { + "name": "sxc", + "type": "cell", + "actions": ["view", "edit"], + "convert": [], + "mime": null + }, + { + "name": "xls", + "type": "cell", + "actions": ["view", "edit"], + "convert": ["xlsx", "csv", "ods", "ots", "pdf", "pdfa", "xltx", "xlsm", "xltm"], + "mime": "application/vnd.ms-excel" + }, + { + "name": "xlsb", + "type": "cell", + "actions": ["view", "edit"], + "convert": [], + "mime": null + }, + { + "name": "xlsm", + "type": "cell", + "actions": ["view", "edit"], + "convert": ["xlsx", "csv", "ods", "ots", "pdf", "pdfa", "xltx", "xltm"], + "mime": "application/vnd.ms-excel.sheet.macroEnabled.12" + }, + { + "name": "xlsx", + "type": "cell", + "actions": ["view", "edit"], + "convert": ["csv", "ods", "ots", "pdf", "pdfa", "xltx", "xlsm", "xltm"], + "mime": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" + }, + { + "name": "xlt", + "type": "cell", + "actions": ["view", "edit"], + "convert": ["xlsx", "csv", "ods", "ots", "pdf", "pdfa", "xltx", "xlsm", "xltm"], + "mime": "application/vnd.ms-excel" + }, + { + "name": "xltm", + "type": "cell", + "actions": ["view", "edit"], + "convert": ["xlsx", "csv", "ods", "ots", "pdf", "pdfa", "xltx", "xlsm"], + "mime": "application/vnd.ms-excel.template.macroenabled.12" + }, + { + "name": "xltx", + "type": "cell", + "actions": ["view", "edit"], + "convert": [], + "mime": null + }, + { + "name": "dps", + "type": "slide", + "actions": ["view", "edit"], + "convert": [], + "mime": null + }, + { + "name": "dpt", + "type": "slide", + "actions": ["view", "edit"], + "convert": [], + "mime": null + }, + { + "name": "fodp", + "type": "slide", + "actions": ["view", "edit"], + "convert": ["pptx", "odp", "otp", "pdf", "pdfa", "potx", "pptm", "potm"], + "mime": "application/vnd.oasis.opendocument.presentation" + }, + { + "name": "odp", + "type": "slide", + "actions": ["view", "lossy-edit"], + "convert": ["pptx", "otp", "pdf", "pdfa", "potx", "pptm", "potm"], + "mime": "application/vnd.oasis.opendocument.presentation" + }, + { + "name": "otp", + "type": "slide", + "actions": ["view", "lossy-edit"], + "convert": ["pptx", "odp", "pdf", "pdfa", "potx", "pptm", "potm"], + "mime": "application/vnd.oasis.opendocument.presentation-template" + }, + { + "name": "pot", + "type": "slide", + "actions": ["view", "edit"], + "convert": ["pptx", "odp", "otp", "pdf", "pdfa", "potx", "pptm", "potm"], + "mime": "application/vnd.ms-powerpoint" + }, + { + "name": "potm", + "type": "slide", + "actions": ["view", "edit"], + "convert": ["pptx", "odp", "otp", "pdf", "pdfa", "potx", "pptm"], + "mime": "application/vnd.ms-powerpoint.template.macroEnabled.12" + }, + { + "name": "potx", + "type": "slide", + "actions": ["view", "edit"], + "convert": ["pptx", "odp", "otp", "pdf", "pdfa", "pptm", "potm"], + "mime": "application/vnd.openxmlformats-officedocument.presentationml.template" + }, + { + "name": "pps", + "type": "slide", + "actions": ["view", "edit"], + "convert": ["pptx", "odp", "otp", "pdf", "pdfa", "potx", "pptm", "potm"], + "mime": "application/vnd.ms-powerpoint" + }, + { + "name": "ppsm", + "type": "slide", + "actions": ["view", "edit"], + "convert": ["pptx", "odp", "otp", "pdf", "pdfa", "potx", "pptm", "potm"], + "mime": "application/vnd.ms-powerpoint.slideshow.macroenabled.12" + }, + { + "name": "ppsx", + "type": "slide", + "actions": ["view", "edit"], + "convert": ["pptx", "odp", "otp", "pdf", "pdfa", "potx", "pptm", "potm"], + "mime": "application/vnd.openxmlformats-officedocument.presentationml.slideshow" + }, + { + "name": "ppt", + "type": "slide", + "actions": ["view", "edit"], + "convert": ["pptx", "odp", "otp", "pdf", "pdfa", "potx", "pptm", "potm"], + "mime": "application/vnd.ms-powerpoint" + }, + { + "name": "pptm", + "type": "slide", + "actions": ["view", "edit"], + "convert": ["pptx", "odp", "otp", "pdf", "pdfa", "potx", "potm"], + "mime": "application/vnd.ms-powerpoint.presentation.macroenabled.12" + }, + { + "name": "pptx", + "type": "slide", + "actions": ["view", "edit"], + "convert": ["odp", "otp", "pdf", "pdfa", "potx", "pptm", "potm"], + "mime": "application/vnd.openxmlformats-officedocument.presentationml.presentation" + }, + { + "name": "sxi", + "type": "slide", + "actions": ["view", "edit"], + "convert": [], + "mime": null + } +] \ No newline at end of file diff --git a/web/documentserver-example/nodejs/helpers/docManager.js b/web/documentserver-example/nodejs/helpers/docManager.js index 43a4ff9d..15db0408 100644 --- a/web/documentserver-example/nodejs/helpers/docManager.js +++ b/web/documentserver-example/nodejs/helpers/docManager.js @@ -323,13 +323,13 @@ DocManager.prototype.getStoredFiles = function getStoredFiles() { } const time = stats.mtime.getTime(); // get the time of element modification - const item = { // create an object with element data - time, - name: storedFiles[i], - documentType: fileUtility.getFileType(storedFiles[i]), - canEdit: configServer.get('editedDocs').indexOf(fileUtility.getFileExtension(storedFiles[i])) !== -1, - version: version + 1, - }; + const item = { // create an object with element data + time, + name: storedFiles[i], + documentType: fileUtility.getFileType(storedFiles[i]), + canEdit: fileUtility.getEditExtensions().indexOf(fileUtility.getFileExtension(storedFiles[i], true)) !== -1, + version: version + 1, + }; if (!result.length) { // if the result array is empty result.push(item); // push the item object to it diff --git a/web/documentserver-example/nodejs/helpers/fileUtility.js b/web/documentserver-example/nodejs/helpers/fileUtility.js index c2a74dd9..b502c116 100644 --- a/web/documentserver-example/nodejs/helpers/fileUtility.js +++ b/web/documentserver-example/nodejs/helpers/fileUtility.js @@ -16,6 +16,7 @@ * */ +const supportedFormats = require("../config/onlyoffice-docs-formats.json") const fileUtility = {}; // get file name from the given url @@ -49,14 +50,11 @@ fileUtility.getFileExtension = function getFileExtension(url, withoutDot) { // get file type from the given url fileUtility.getFileType = function getFileType(url) { - const ext = fileUtility.getFileExtension(url); // get the file extension from the given url + const ext = fileUtility.getFileExtension(url, true); // get the file extension from the given url - // word type for document extensions - if (fileUtility.documentExts.indexOf(ext) !== -1) return fileUtility.fileType.word; - // cell type for spreadsheet extensions - if (fileUtility.spreadsheetExts.indexOf(ext) !== -1) return fileUtility.fileType.cell; - // slide type for presentation extensions - if (fileUtility.presentationExts.indexOf(ext) !== -1) return fileUtility.fileType.slide; + for(let format of supportedFormats) { + if (format.name === ext) return format.type; + } return fileUtility.fileType.word; // the default file type is word }; @@ -67,17 +65,30 @@ fileUtility.fileType = { slide: 'slide', }; -// the document extension list -fileUtility.documentExts = ['.doc', '.docx', '.oform', '.docm', '.dot', '.dotx', '.dotm', '.odt', - '.fodt', '.ott', '.rtf', '.txt', '.html', '.htm', '.mht', '.xml', '.pdf', '.djvu', '.fb2', '.epub', '.xps', '.oxps']; +fileUtility.getSuppotredExtensions = function getSuppotredExtensions() { + return supportedFormats.reduce((extensions, format) => [...extensions, format.name], []); +} -// the spreadsheet extension list -fileUtility.spreadsheetExts = ['.xls', '.xlsx', '.xlsm', '.xlsb', '.xlt', - '.xltx', '.xltm', '.ods', '.fods', '.ots', '.csv']; +fileUtility.getViewExtensions = function getViewExtensions() { + return supportedFormats.filter((format) => format.actions.includes('view')).reduce((extensions, format) => [...extensions, format.name], []); +} -// the presentation extension list -fileUtility.presentationExts = ['.pps', '.ppsx', '.ppsm', '.ppt', '.pptx', '.pptm', '.pot', - '.potx', '.potm', '.odp', '.fodp', '.otp']; +fileUtility.getEditExtensions = function getEditExtensions() { + return supportedFormats.filter((format) => format.actions.includes('edit')).reduce((extensions, format) => [...extensions, format.name], []); +} + +fileUtility.getFillExtensions = function getFillExtensions() { + return supportedFormats.filter((format) => format.actions.includes('fill')).reduce((extensions, format) => [...extensions, format.name], []); +} + +fileUtility.getConvertExtensions = function getConvertExtensions() { + return supportedFormats.filter( + (format) => + format.type === "word" && format.convert.includes('docx') + || format.type === "cell" && format.convert.includes('xlsx') + || format.type === "slide" && format.convert.includes('pptx') + ).reduce((extensions, format) => [...extensions, format.name], []); +} // get url parameters // eslint-disable-next-line no-unused-vars diff --git a/web/documentserver-example/nodejs/helpers/wopi/wopiRouting.js b/web/documentserver-example/nodejs/helpers/wopi/wopiRouting.js index a9f980a9..296380ba 100755 --- a/web/documentserver-example/nodejs/helpers/wopi/wopiRouting.js +++ b/web/documentserver-example/nodejs/helpers/wopi/wopiRouting.js @@ -57,8 +57,8 @@ exports.registerRoutes = function registerRoutes(app) { }); // Checking supported extensions - const editedExts = configServer.get('editedDocs').filter((i) => docsExtEdit.includes(i)); - const fillExts = configServer.get('fillDocs').filter((i) => docsExtEdit.includes(i)); + const editedExts = fileUtility.getEditExtensions().filter((i) => docsExtEdit.includes(i)); + const fillExts = fileUtility.getFillExtensions().filter((i) => docsExtEdit.includes(i)); try { // get all the stored files @@ -82,7 +82,7 @@ exports.registerRoutes = function registerRoutes(app) { users, serverUrl: req.DocManager.getServerUrl(), preloaderUrl: siteUrl + configServer.get('preloaderUrl'), - convertExts: configServer.get('convertedDocs'), + convertExts: fileUtility.getConvertExtensions(), editedExts, fillExts, languages: configServer.get('languages'), @@ -90,7 +90,8 @@ exports.registerRoutes = function registerRoutes(app) { } catch (ex) { console.log(ex); // display error message in the console res.status(500); // write status parameter to the response - res.render('error', { message: 'Server error' }); // render error template with the message parameter specified + // render error template with the message parameter specified + res.render('error', { message: 'Server error' }); } }); // define a handler for creating a new wopi editing session diff --git a/web/documentserver-example/nodejs/public/javascripts/jscript.js b/web/documentserver-example/nodejs/public/javascripts/jscript.js index bc1b6538..50106b1f 100644 --- a/web/documentserver-example/nodejs/public/javascripts/jscript.js +++ b/web/documentserver-example/nodejs/public/javascripts/jscript.js @@ -126,7 +126,7 @@ if (typeof jQuery != "undefined") { jq("#filePass").val(""); var fileName = jq("#hiddenFileName").val(); - var posExt = fileName.lastIndexOf('.'); + var posExt = fileName.lastIndexOf('.') + 1; posExt = 0 <= posExt ? fileName.substring(posExt).trim().toLowerCase() : ''; if (ConverExtList.indexOf(posExt) == -1) { @@ -207,7 +207,7 @@ if (typeof jQuery != "undefined") { jq("#beginView, #beginEmbedded").removeClass("disable"); var fileName = jq("#hiddenFileName").val(); - var posExt = fileName.lastIndexOf('.'); + var posExt = fileName.lastIndexOf('.') + 1; posExt = 0 <= posExt ? fileName.substring(posExt).trim().toLowerCase() : ''; var checkEdited = EditedExtList.split(",").filter(function(ext) { return ext == posExt;}); diff --git a/web/documentserver-example/nodejs/views/index.ejs b/web/documentserver-example/nodejs/views/index.ejs index 5de68c48..aea90e8c 100755 --- a/web/documentserver-example/nodejs/views/index.ejs +++ b/web/documentserver-example/nodejs/views/index.ejs @@ -189,7 +189,7 @@ <% if (storedFiles[i].documentType !== "word" && storedFiles[i].documentType !== "cell") {%>