diff --git a/tdrive/backend/node/src/services/documents/services/index.ts b/tdrive/backend/node/src/services/documents/services/index.ts index 744b73f3..27881628 100644 --- a/tdrive/backend/node/src/services/documents/services/index.ts +++ b/tdrive/backend/node/src/services/documents/services/index.ts @@ -549,7 +549,7 @@ export class DocumentsService { } const updatable = ["access_info", "name", "tags", "parent_id", "description", "is_in_trash"]; - + let renamedTo: string | undefined; for (const key of updatable) { if ((content as any)[key]) { if ( @@ -590,7 +590,7 @@ export class DocumentsService { } }); } else if (key === "name") { - item.name = await getItemName( + renamedTo = item.name = await getItemName( content.parent_id || item.parent_id, item.id, content.name, @@ -621,7 +621,17 @@ export class DocumentsService { await updateItemSize(oldParent, this.repository, context); } - + if (renamedTo && item.editing_session_key) + ApplicationsApiService.getDefault() + .renameEditingKeyFilename(item.editing_session_key, renamedTo) + .catch(err => { + logger.error("Error rename editing session to new name", { + err, + editing_session_key: item.editing_session_key, + renamedTo, + }); + /* Ignore errors, just throw it out there... */ + }); if (item.parent_id === this.TRASH) { //When moving to trash we recompute the access level to make them flat item.access_info = await makeStandaloneAccessLevel( diff --git a/tdrive/connectors/onlyoffice-connector/src/controllers/browser-editor.controller.ts b/tdrive/connectors/onlyoffice-connector/src/controllers/browser-editor.controller.ts index a32b98b4..7b912612 100644 --- a/tdrive/connectors/onlyoffice-connector/src/controllers/browser-editor.controller.ts +++ b/tdrive/connectors/onlyoffice-connector/src/controllers/browser-editor.controller.ts @@ -89,7 +89,7 @@ class BrowserEditorController { drive_file_id, editing_session_key: editingSessionKey, file_id: file.id, - file_name: file.filename || file?.metadata?.name || '', + file_name: driveFile?.item?.name || file.filename || file.metadata?.name || '', preview: !!preview, } as OfficeToken, CREDENTIALS_SECRET, diff --git a/tdrive/connectors/onlyoffice-connector/src/interfaces/drive.interface.ts b/tdrive/connectors/onlyoffice-connector/src/interfaces/drive.interface.ts index 9755461c..4384d561 100644 --- a/tdrive/connectors/onlyoffice-connector/src/interfaces/drive.interface.ts +++ b/tdrive/connectors/onlyoffice-connector/src/interfaces/drive.interface.ts @@ -1,6 +1,7 @@ export type DriveFileType = { access: 'manage' | 'write' | 'read' | 'none'; item: { + name: string; last_version_cache: { id: string; date_added: number;