mirror of
https://github.com/ONLYOFFICE/server.git
synced 2026-04-07 14:04:35 +08:00
Merged revision(s) 65734-65843 from AVS/Sources/TeamlabOffice/branches/TeamlabOffice_v3.5_Konovalov:
r65834 проблемы при открытии списков с NumStyleLink, StyleLink --------------------- r65795 sendServerRequestPromise не посылаем url если его нет. --------------------- r65776 Bug 29730 - Появление лишних строк при открытии документа docx --------------------- r65773 ErrToReload --------------------- r65772 ошибка при update task_result --------------------- r65770 по логам stdout stderr иногда могут быть null --------------------- r65769 дополнение к Revision: 65514. неправильное имя при скачивании файла с именем "Тест Подсветка" --------------------- git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/nodeJSProjects@65844 954022d7-b5bf-4e40-9824-e11837661b57
This commit is contained in:
committed by
Alexander.Trofimov
parent
062658be77
commit
78db0e00fc
@ -388,6 +388,105 @@ function ErrorWithResult() {
|
||||
this.data = null;
|
||||
}
|
||||
|
||||
function OutputSfcData() {
|
||||
this['key'] = undefined;
|
||||
this['status'] = undefined;
|
||||
this['url'] = undefined;
|
||||
this['changesurl'] = undefined;
|
||||
this['changeshistory'] = undefined;
|
||||
this['users'] = [];
|
||||
this['mailMerge'] = undefined;
|
||||
}
|
||||
OutputSfcData.prototype.getKey = function() {
|
||||
return this['key'];
|
||||
};
|
||||
OutputSfcData.prototype.setKey = function(data) {
|
||||
return this['key'] = data;
|
||||
};
|
||||
OutputSfcData.prototype.getStatus = function() {
|
||||
return this['status'];
|
||||
};
|
||||
OutputSfcData.prototype.setStatus = function(data) {
|
||||
return this['status'] = data;
|
||||
};
|
||||
OutputSfcData.prototype.getUrl = function() {
|
||||
return this['url'];
|
||||
};
|
||||
OutputSfcData.prototype.setUrl = function(data) {
|
||||
return this['url'] = data;
|
||||
};
|
||||
OutputSfcData.prototype.getChangeUrl = function() {
|
||||
return this['changesurl'];
|
||||
};
|
||||
OutputSfcData.prototype.setChangeUrl = function(data) {
|
||||
return this['changesurl'] = data;
|
||||
};
|
||||
OutputSfcData.prototype.getChangeHistory = function() {
|
||||
return this['changeshistory'];
|
||||
};
|
||||
OutputSfcData.prototype.setChangeHistory = function(data) {
|
||||
return this['changeshistory'] = data;
|
||||
};
|
||||
OutputSfcData.prototype.getUsers = function() {
|
||||
return this['users'];
|
||||
};
|
||||
OutputSfcData.prototype.setUsers = function(data) {
|
||||
return this['users'] = data;
|
||||
};
|
||||
OutputSfcData.prototype.getMailMerge = function() {
|
||||
return this['mailMerge'];
|
||||
};
|
||||
OutputSfcData.prototype.setMailMerge = function(data) {
|
||||
return this['mailMerge'] = data;
|
||||
};
|
||||
function OutputMailMerge(mailMergeSendData) {
|
||||
if (mailMergeSendData) {
|
||||
this['from'] = mailMergeSendData.getFrom();
|
||||
this['message'] = mailMergeSendData.getMessage();
|
||||
this['subject'] = mailMergeSendData.getSubject();
|
||||
this['title'] = mailMergeSendData.getFileName();
|
||||
var mailFormat = mailMergeSendData.getMailFormat();
|
||||
switch (mailFormat) {
|
||||
case constants.AVS_OFFICESTUDIO_FILE_OTHER_HTMLZIP :
|
||||
this['type'] = 0;
|
||||
break;
|
||||
case constants.AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX :
|
||||
this['type'] = 1;
|
||||
break;
|
||||
case constants.AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_PDF :
|
||||
this['type'] = 2;
|
||||
break;
|
||||
default :
|
||||
this['type'] = 0;
|
||||
break;
|
||||
}
|
||||
this['recordCount'] = mailMergeSendData.getRecordCount();
|
||||
this['to'] = null;
|
||||
this['recordIndex'] = null;
|
||||
} else {
|
||||
this['from'] = null;
|
||||
this['message'] = null;
|
||||
this['subject'] = null;
|
||||
this['title'] = null;
|
||||
this['to'] = null;
|
||||
this['type'] = null;
|
||||
this['recordCount'] = null;
|
||||
this['recordIndex'] = null;
|
||||
}
|
||||
}
|
||||
OutputMailMerge.prototype.getRecordIndex = function() {
|
||||
return this['recordIndex'];
|
||||
};
|
||||
OutputMailMerge.prototype.setRecordIndex = function(data) {
|
||||
return this['recordIndex'] = data;
|
||||
};
|
||||
OutputMailMerge.prototype.getTo = function() {
|
||||
return this['to'];
|
||||
};
|
||||
OutputMailMerge.prototype.setTo = function(data) {
|
||||
return this['to'] = data;
|
||||
};
|
||||
|
||||
var c_oAscCsvDelimiter = {
|
||||
None: 0,
|
||||
Tab: 1,
|
||||
@ -475,6 +574,8 @@ exports.TaskQueueData = TaskQueueData;
|
||||
exports.CMailMergeSendData = CMailMergeSendData;
|
||||
exports.InputCommand = InputCommand;
|
||||
exports.ErrorWithResult = ErrorWithResult;
|
||||
exports.OutputSfcData = OutputSfcData;
|
||||
exports.OutputMailMerge = OutputMailMerge;
|
||||
exports.c_oAscCsvDelimiter = c_oAscCsvDelimiter;
|
||||
exports.c_oAscEncodings = c_oAscEncodings;
|
||||
exports.c_oAscEncodingsMap = c_oAscEncodingsMap;
|
||||
|
||||
@ -622,8 +622,11 @@ function* sendStatusDocument(docId, bChangeBase, callback, baseUrl) {
|
||||
}
|
||||
}
|
||||
|
||||
var sendData = JSON.stringify({'key': docId, 'status': status, 'url': '', 'users': participants});
|
||||
var replyData = yield sendServerRequestPromise(docId, callback, sendData);
|
||||
var sendData = new commonDefines.OutputSfcData();
|
||||
sendData.setKey(docId);
|
||||
sendData.setStatus(status);
|
||||
sendData.setUsers(participants);
|
||||
var replyData = yield sendServerRequestPromise(docId, callback, JSON.stringify(sendData));
|
||||
yield* onReplySendStatusDocument(docId, replyData);
|
||||
}
|
||||
function* onReplySendStatusDocument(docId, replyData) {
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -17,14 +17,18 @@ var clientStatsD = statsDClient.getClient();
|
||||
function* getConvertStatus(cmd, selectRes, req) {
|
||||
var status = {url: undefined, err: constants.NO_ERROR};
|
||||
if (selectRes.length > 0) {
|
||||
var docId = cmd.getDocId();
|
||||
var row = selectRes[0];
|
||||
switch (row.tr_status) {
|
||||
case taskResult.FileStatus.Ok:
|
||||
status.url = yield storage.getSignedUrl(utils.getBaseUrlByRequest(req), cmd.getDocId() + '/' + cmd.getTitle());
|
||||
status.url = yield storage.getSignedUrl(utils.getBaseUrlByRequest(req), docId + '/' + cmd.getTitle());
|
||||
break;
|
||||
case taskResult.FileStatus.Err:
|
||||
case taskResult.FileStatus.ErrToReload:
|
||||
status.err = row.tr_status_info;
|
||||
if (taskResult.FileStatus.ErrToReload == row.tr_status) {
|
||||
yield taskResult.remove(docId);
|
||||
}
|
||||
break;
|
||||
case taskResult.FileStatus.NeedParams:
|
||||
case taskResult.FileStatus.SaveVersion:
|
||||
|
||||
@ -28,6 +28,7 @@ if (cluster.isMaster) {
|
||||
var urlModule = require('url');
|
||||
var path = require('path');
|
||||
var bodyParser = require("body-parser");
|
||||
var mime = require('mime');
|
||||
var docsCoServer = require('./DocsCoServer');
|
||||
var canvasService = require('./canvasservice');
|
||||
var converterService = require('./converterservice');
|
||||
@ -64,18 +65,30 @@ if (cluster.isMaster) {
|
||||
var cfgStorageFolderName = configStorage.get('storageFolderName');
|
||||
app.use('/' + cfgBucketName + '/' + cfgStorageFolderName, function(req, res, next) {
|
||||
var index = req.url.lastIndexOf('/');
|
||||
var contentDisposition = 'attachment;';
|
||||
if (-1 != index) {
|
||||
var sendFileOptions = {
|
||||
root: configStorage.get('fs.folderPath'),
|
||||
dotfiles: 'deny',
|
||||
headers: {
|
||||
'Content-Disposition': 'attachment;'
|
||||
}
|
||||
};
|
||||
var urlParsed = urlModule.parse(req.url);
|
||||
if (urlParsed && urlParsed.pathname) {
|
||||
var filename = decodeURIComponent(path.basename(urlParsed.pathname));
|
||||
contentDisposition = utils.getContentDisposition(filename, req.headers['user-agent']);
|
||||
sendFileOptions.headers['Content-Type'] = mime.lookup(filename);
|
||||
}
|
||||
req.url = req.url.substring(0, index);
|
||||
var realUrl = req.url.substring(0, index);
|
||||
res.sendFile(realUrl, sendFileOptions, function (err) {
|
||||
if (err) {
|
||||
logger.error(err);
|
||||
res.status(err.status).end();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
req.sendStatus(404)
|
||||
}
|
||||
res.setHeader("Content-Disposition", contentDisposition);
|
||||
next();
|
||||
}, express.static(configStorage.get('fs.folderPath')));
|
||||
});
|
||||
}
|
||||
|
||||
// Если захочется использовать 'development' и 'production',
|
||||
|
||||
@ -68,14 +68,14 @@ function select(task) {
|
||||
}
|
||||
function toUpdateArray(task, updateTime) {
|
||||
var res = [];
|
||||
if (task.format) {
|
||||
if (null != task.format) {
|
||||
res.push('tr_format=' + sqlBase.baseConnector.sqlEscape(task.format));
|
||||
}
|
||||
if (task.status) {
|
||||
if (null != task.status) {
|
||||
res.push('tr_status=' + sqlBase.baseConnector.sqlEscape(task.status));
|
||||
}
|
||||
if (task.statusInfo) {
|
||||
res.push('tr_status_info=' + sqlBase.baseConnector.sqlEscape(task.status));
|
||||
if (null != task.statusInfo) {
|
||||
res.push('tr_status_info=' + sqlBase.baseConnector.sqlEscape(task.statusInfo));
|
||||
}
|
||||
if (updateTime) {
|
||||
res.push('tr_last_open_date=' + sqlBase.getDateTime(new Date()));
|
||||
|
||||
@ -289,7 +289,9 @@ function* postProcess(cmd, dataConvert, tempDirs, childRes, error) {
|
||||
if(childRes) {
|
||||
exitCode = childRes.status;
|
||||
exitSignal = childRes.signal;
|
||||
logger.debug('stdout (id=' + dataConvert.key + '):' + childRes.stdout.toString());
|
||||
if (childRes.stdout) {
|
||||
logger.debug('stdout (id=' + dataConvert.key + '):' + childRes.stdout.toString());
|
||||
}
|
||||
}
|
||||
if (0 !== exitCode || null !== exitSignal) {
|
||||
if (-constants.CONVERT_MS_OFFCRYPTO == exitCode) {
|
||||
@ -304,7 +306,7 @@ function* postProcess(cmd, dataConvert, tempDirs, childRes, error) {
|
||||
if (constants.CONVERT_MS_OFFCRYPTO == error || constants.CONVERT_NEED_PARAMS == error) {
|
||||
logger.debug('ExitCode (code=%d;signal=%s;error:%d;id=%s)', exitCode, exitSignal, error, dataConvert.key);
|
||||
} else {
|
||||
if(childRes) {
|
||||
if (childRes && childRes.stderr) {
|
||||
logger.error('stderr (id=' + dataConvert.key + '):' + childRes.stderr.toString());
|
||||
}
|
||||
logger.error('ExitCode (code=%d;signal=%s;error:%d;id=%s)', exitCode, exitSignal, error, dataConvert.key);
|
||||
|
||||
Reference in New Issue
Block a user