From bb57361cd0d1cbdc395ca0a1e9e21db068916d2d Mon Sep 17 00:00:00 2001 From: Jannik Stehle Date: Wed, 19 Jun 2024 12:50:49 +0200 Subject: [PATCH] fix: editor save after token renewal The issue existed because the `ClientService` had been destructured, which lead to the request headers not being reactive. --- .../unreleased/bugfix-editor-save-after-token-renewal | 6 ++++++ .../src/composables/appDefaults/useAppFileHandling.ts | 10 +++++----- 2 files changed, 11 insertions(+), 5 deletions(-) create mode 100644 changelog/unreleased/bugfix-editor-save-after-token-renewal diff --git a/changelog/unreleased/bugfix-editor-save-after-token-renewal b/changelog/unreleased/bugfix-editor-save-after-token-renewal new file mode 100644 index 00000000000..21287fc40df --- /dev/null +++ b/changelog/unreleased/bugfix-editor-save-after-token-renewal @@ -0,0 +1,6 @@ +Bugfix: Editor save after token renewal + +We've fixed a bug where saving changes in an editor would not work after the access token has been renewed. + +https://github.com/owncloud/web/pull/11068 +https://github.com/owncloud/web/issues/11062 diff --git a/packages/web-pkg/src/composables/appDefaults/useAppFileHandling.ts b/packages/web-pkg/src/composables/appDefaults/useAppFileHandling.ts index a0e6495f76f..d95bfe4ccf6 100644 --- a/packages/web-pkg/src/composables/appDefaults/useAppFileHandling.ts +++ b/packages/web-pkg/src/composables/appDefaults/useAppFileHandling.ts @@ -36,9 +36,9 @@ export interface AppFileHandlingResult { } export function useAppFileHandling({ - clientService: { webdav } + clientService }: AppFileHandlingOptions): AppFileHandlingResult { - const clientService = useClientService() + clientService = clientService || useClientService() const capabilityStore = useCapabilityStore() const userStore = useUserStore() @@ -63,7 +63,7 @@ export function useAppFileHandling({ fileContext: MaybeRef, options: { responseType?: 'arraybuffer' | 'blob' | 'text' } & Record ) => { - return webdav.getFileContents( + return clientService.webdav.getFileContents( unref(unref(fileContext).space), { path: unref(unref(fileContext).item) @@ -78,7 +78,7 @@ export function useAppFileHandling({ fileContext: MaybeRef, options: ListFilesOptions = {} ): Promise => { - return webdav.getFileInfo( + return clientService.webdav.getFileInfo( unref(unref(fileContext).space), { path: unref(unref(fileContext).item), @@ -92,7 +92,7 @@ export function useAppFileHandling({ fileContext: MaybeRef, options: { content?: string } & Record ) => { - return webdav.putFileContents(unref(unref(fileContext).space), { + return clientService.webdav.putFileContents(unref(unref(fileContext).space), { path: unref(unref(fileContext).item), ...options })