mirror of
https://github.com/ONLYOFFICE/document-server-integration.git
synced 2026-04-07 14:06:11 +08:00
nodejs: fix lint
This commit is contained in:
@ -326,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,true);
|
||||
const fileExt = fileUtility.getFileExtension(fileName, true);
|
||||
const internalFileExt = 'ooxml';
|
||||
const response = res;
|
||||
|
||||
@ -1050,7 +1050,9 @@ app.get('/editor', (req, res) => { // define a handler for editing document
|
||||
dataCompareFile: {
|
||||
fileType: 'docx',
|
||||
url: `${req.DocManager.getServerUrl(true)}/assets/document-templates/sample/sample.docx`,
|
||||
directUrl: !userDirectUrl ? null : `${req.DocManager.getServerUrl()}/assets/document-templates/sample/sample.docx`,
|
||||
directUrl: !userDirectUrl
|
||||
? null
|
||||
: `${req.DocManager.getServerUrl()}/assets/document-templates/sample/sample.docx`,
|
||||
},
|
||||
dataMailMergeRecipients: {
|
||||
fileType: 'csv',
|
||||
|
||||
@ -16,7 +16,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
const supportedFormats = require("../public/assets/document-formats/onlyoffice-docs-formats.json")
|
||||
const supportedFormats = require('../public/assets/document-formats/onlyoffice-docs-formats.json');
|
||||
|
||||
const fileUtility = {};
|
||||
|
||||
// get file name from the given url
|
||||
@ -52,8 +53,8 @@ fileUtility.getFileExtension = function getFileExtension(url, withoutDot) {
|
||||
fileUtility.getFileType = function getFileType(url) {
|
||||
const ext = fileUtility.getFileExtension(url, true); // get the file extension from the given url
|
||||
|
||||
for(let format of supportedFormats) {
|
||||
if (format.name === ext) return format.type;
|
||||
for (let i = 0; i < supportedFormats.length; i++) {
|
||||
if (supportedFormats[i].name === ext) return supportedFormats[i].type;
|
||||
}
|
||||
|
||||
return fileUtility.fileType.word; // the default file type is word
|
||||
@ -67,28 +68,33 @@ fileUtility.fileType = {
|
||||
|
||||
fileUtility.getSuppotredExtensions = function getSuppotredExtensions() {
|
||||
return supportedFormats.reduce((extensions, format) => [...extensions, format.name], []);
|
||||
}
|
||||
};
|
||||
|
||||
fileUtility.getViewExtensions = function getViewExtensions() {
|
||||
return supportedFormats.filter((format) => format.actions.includes('view')).reduce((extensions, format) => [...extensions, format.name], []);
|
||||
}
|
||||
return supportedFormats.filter(
|
||||
(format) => format.actions.includes('view'),
|
||||
).reduce((extensions, format) => [...extensions, format.name], []);
|
||||
};
|
||||
|
||||
fileUtility.getEditExtensions = function getEditExtensions() {
|
||||
return supportedFormats.filter((format) => format.actions.includes('edit')).reduce((extensions, format) => [...extensions, format.name], []);
|
||||
}
|
||||
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], []);
|
||||
}
|
||||
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], []);
|
||||
}
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user