Skip to content

Commit

Permalink
[feature] Omit X-WOPI-Lock during document creation.
Browse files Browse the repository at this point in the history
  • Loading branch information
konovalovsergey committed Jan 22, 2024
1 parent a58c86d commit 28bdee7
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions DocService/sources/wopiClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,6 @@ function discovery(req, res) {
xmlApp.ele('action', {name: 'view', ext: ext.edit[j], urlsrc: urlTemplateView}).up();
xmlApp.ele('action', {name: 'embedview', ext: ext.edit[j], urlsrc: urlTemplateEmbedView}).up();
xmlApp.ele('action', {name: 'mobileView', ext: ext.edit[j], urlsrc: urlTemplateMobileView}).up();
// if ("oform" !== ext.edit[j]) {
// //todo config
// xmlApp.ele('action', {name: 'editnew', ext: ext.edit[j], requires: 'locks,update', urlsrc: urlTemplateEdit}).up();
// }
xmlApp.ele('action', {name: 'edit', ext: ext.edit[j], default: 'true', requires: 'locks,update', urlsrc: urlTemplateEdit}).up();
xmlApp.ele('action', {name: 'mobileEdit', ext: ext.edit[j], requires: 'locks,update', urlsrc: urlTemplateMobileEdit}).up();
}
Expand Down Expand Up @@ -401,6 +397,8 @@ function getEditorHtml(req, res) {
let mode = req.params.mode;
let sc = req.query['sc'];
let hostSessionId = req.query['hid'];
let lang = req.query['lang'];
let ui = req.query['ui'];
let access_token = req.body['access_token'] || "";
let access_token_ttl = parseInt(req.body['access_token_ttl']) || 0;

Expand Down Expand Up @@ -453,14 +451,14 @@ function getEditorHtml(req, res) {

// TODO: throw error if format not supported?
if (fileInfo.Size === 0 && fileType.length !== 0) {
const wopiParams = getWopiParams('', fileInfo, wopiSrc, access_token, access_token_ttl);
const wopiParams = getWopiParams(undefined, fileInfo, wopiSrc, access_token, access_token_ttl);

if (templatesFolderLocalesCache === null) {
const dirContent = yield readdir(`${tenNewFileTemplate}/`, { withFileTypes: true });
templatesFolderLocalesCache = dirContent.filter(dirObject => dirObject.isDirectory()).map(dirObject => dirObject.name);
}

const localePrefix = params.queryParams.lang || params.queryParams.ui || 'en';
const localePrefix = lang || ui || 'en';
let locale = constants.TEMPLATES_FOLDER_LOCALE_COLLISON_MAP[localePrefix] ?? templatesFolderLocalesCache.find(locale => locale.startsWith(localePrefix));
if (locale === undefined) {
locale = 'en-US';
Expand Down Expand Up @@ -542,7 +540,7 @@ function getConverterHtml(req, res) {
return;
}

let wopiParams = getWopiParams(null, fileInfo, wopiSrc, access_token, access_token_ttl);
let wopiParams = getWopiParams(undefined, fileInfo, wopiSrc, access_token, access_token_ttl);

let docId = yield converterService.convertAndEdit(ctx, wopiParams, ext, targetext);
if (docId) {
Expand Down

0 comments on commit 28bdee7

Please sign in to comment.