diff --git a/changelog/unreleased/bugfix-external-apps b/changelog/unreleased/bugfix-external-apps new file mode 100644 index 00000000000..7490e72ae45 --- /dev/null +++ b/changelog/unreleased/bugfix-external-apps @@ -0,0 +1,7 @@ +Bugfix: External apps fixes + +Bug introduced in #6870. A method used to communicate with the backend was not properly added to the extension after being moved to a different location. + +(bonus: app name back in the title) + +https://github.com/owncloud/web/pull/7166 diff --git a/packages/web-app-external/src/App.vue b/packages/web-app-external/src/App.vue index f58b64e56f9..2b40a285eaa 100644 --- a/packages/web-app-external/src/App.vue +++ b/packages/web-app-external/src/App.vue @@ -103,6 +103,17 @@ export default { return this.$route.query.fileId } }, + mounted() { + if (this.appName) { + document.title = [ + this.currentFileContext.fileName, + this.appName, + this.configuration.currentTheme.general.name + ] + .filter(Boolean) + .join(' - ') + } + }, async created() { await unauthenticatedUserReady(this.$router, this.$store) @@ -130,9 +141,7 @@ export default { return } - const data = await response.json() - - if (!data.app_url || !data.method) { + if (!response.data.app_url || !response.data.method) { this.errorMessage = this.$gettext('Error in app server response') this.loading = false this.loadingError = true @@ -140,9 +149,9 @@ export default { return } - this.appUrl = data.app_url - this.method = data.method - if (data.form_parameters) this.formParameters = data.form_parameters + this.appUrl = response.data.app_url + this.method = response.data.method + if (response.data.form_parameters) this.formParameters = response.data.form_parameters if (this.method === 'POST' && this.formParameters) { this.$nextTick(() => this.$refs.subm.click()) diff --git a/packages/web-app-external/tests/unit/app.spec.js b/packages/web-app-external/tests/unit/app.spec.js index 91b3315c953..938a461aaaa 100644 --- a/packages/web-app-external/tests/unit/app.spec.js +++ b/packages/web-app-external/tests/unit/app.spec.js @@ -143,7 +143,7 @@ describe('The app provider extension', () => { Promise.resolve({ ok: true, status: 200, - json: () => providerSuccessResponseGet + data: providerSuccessResponseGet }) ) @@ -158,7 +158,7 @@ describe('The app provider extension', () => { Promise.resolve({ ok: true, status: 200, - json: () => providerSuccessResponsePost + data: providerSuccessResponsePost }) ) const wrapper = createShallowMountWrapper(makeRequest) diff --git a/packages/web-pkg/src/composables/appDefaults/useAppDefaults.ts b/packages/web-pkg/src/composables/appDefaults/useAppDefaults.ts index 6bda258deb4..fb39d45906c 100644 --- a/packages/web-pkg/src/composables/appDefaults/useAppDefaults.ts +++ b/packages/web-pkg/src/composables/appDefaults/useAppDefaults.ts @@ -15,7 +15,7 @@ import { useAppConfig, AppConfigResult } from './useAppConfig' import { useAppFileHandling, AppFileHandlingResult } from './useAppFileHandling' import { useAppFolderHandling, AppFolderHandlingResult } from './useAppFolderHandling' import { useAppDocumentTitle } from './useAppDocumentTitle' -import { usePublicLinkPassword, usePublicLinkContext } from '../authContext' +import { usePublicLinkPassword, usePublicLinkContext, useRequest } from '../authContext' import { useClientService } from '../clientService' // TODO: this file/folder contains file/folder loading logic extracted from preview and drawio extensions @@ -76,6 +76,7 @@ export function useAppDefaults(options: AppDefaultsOptions): AppDefaultsResult { isPublicLinkContext, publicLinkPassword }), - ...useAppFolderHandling({ clientService, store, isPublicLinkContext, publicLinkPassword }) + ...useAppFolderHandling({ clientService, store, isPublicLinkContext, publicLinkPassword }), + ...useRequest({ clientService, store, currentRoute: unref(currentRoute) }) } }