Skip to content

Commit

Permalink
[wopi] Restore wopi lock while reconnection; Fix bug 69746
Browse files Browse the repository at this point in the history
  • Loading branch information
konovalovsergey committed Aug 29, 2024
1 parent bf73573 commit 09b3ad2
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions DocService/sources/DocsCoServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2537,7 +2537,7 @@ exports.install = function(server, callbackFunction) {
let docId = data.docid;
const user = data.user;

let wopiParams = null, openedAtStr;
let wopiParams = null, wopiParamsFull = null, openedAtStr;
if (data.documentCallbackUrl) {
wopiParams = wopiClient.parseWopiCallback(ctx, data.documentCallbackUrl);
if (wopiParams && wopiParams.userAuth) {
Expand All @@ -2556,7 +2556,6 @@ exports.install = function(server, callbackFunction) {
let result = yield taskResult.select(ctx, docId);
let resultRow = result.length > 0 ? result[0] : null;
if (wopiParams) {
let wopiParamsFull;
if (resultRow && resultRow.callback) {
wopiParamsFull = wopiClient.parseWopiCallback(ctx, data.documentCallbackUrl, resultRow.callback);
cmd?.setWopiParams(wopiParamsFull);
Expand Down Expand Up @@ -2788,7 +2787,16 @@ exports.install = function(server, callbackFunction) {
var arrayBlocks = data['block'];
var getLockRes = yield getLock(ctx, conn, data, true);
if (arrayBlocks && (0 === arrayBlocks.length || getLockRes)) {
yield* authRestore(ctx, conn, data.sessionId);
let wopiLockRes = true;
if (wopiParamsFull) {
wopiLockRes = yield wopiClient.lock(ctx, 'LOCK', wopiParamsFull.commonInfo.lockId,
wopiParamsFull.commonInfo.fileInfo, wopiParamsFull.userAuth);
}
if (wopiLockRes) {
yield* authRestore(ctx, conn, data.sessionId);
} else {
yield* sendFileErrorAuth(ctx, conn, data.sessionId, 'Restore error. Wopi lock error.', constants.RESTORE_CODE);
}
} else {
yield* sendFileErrorAuth(ctx, conn, data.sessionId, 'Restore error. Locks not checked.', constants.RESTORE_CODE);
}
Expand Down

0 comments on commit 09b3ad2

Please sign in to comment.