From e8d91abf10ea83810c72634029bd70aeac475abb Mon Sep 17 00:00:00 2001 From: JanAckermann Date: Fri, 6 May 2022 09:50:22 +0200 Subject: [PATCH 1/2] Enable optional chaining on configuration access --- packages/web-app-files/src/components/Search/List.vue | 2 +- packages/web-app-files/src/components/Search/Preview.vue | 2 +- .../InviteCollaborator/InviteCollaboratorForm.vue | 4 ++-- .../web-app-files/src/components/SideBar/Shares/FileLinks.vue | 2 +- packages/web-app-files/src/views/Favorites.vue | 2 +- packages/web-app-files/src/views/Personal.vue | 2 +- packages/web-app-files/src/views/PublicFiles.vue | 2 +- packages/web-app-files/src/views/shares/SharedViaLink.vue | 4 ++-- packages/web-app-files/src/views/shares/SharedWithMe.vue | 2 +- packages/web-app-files/src/views/shares/SharedWithOthers.vue | 2 +- packages/web-app-files/src/views/spaces/Project.vue | 2 +- packages/web-runtime/src/components/Topbar/TopBar.vue | 4 ++-- packages/web-runtime/src/components/UploadInfo.vue | 2 +- 13 files changed, 16 insertions(+), 16 deletions(-) diff --git a/packages/web-app-files/src/components/Search/List.vue b/packages/web-app-files/src/components/Search/List.vue index 29fad1d45b4..92d68428f8d 100644 --- a/packages/web-app-files/src/components/Search/List.vue +++ b/packages/web-app-files/src/components/Search/List.vue @@ -83,7 +83,7 @@ export default defineComponent({ ...mapGetters(['configuration']), ...mapGetters('Files', ['totalFilesCount', 'totalFilesSize']), displayThumbnails() { - return !this.configuration.options.disablePreviews + return !this.configuration?.options?.disablePreviews } }, watch: { diff --git a/packages/web-app-files/src/components/Search/Preview.vue b/packages/web-app-files/src/components/Search/Preview.vue index 2e4fb8ae894..6e61f578744 100644 --- a/packages/web-app-files/src/components/Search/Preview.vue +++ b/packages/web-app-files/src/components/Search/Preview.vue @@ -73,7 +73,7 @@ export default { return this.$gettext('Personal') }, displayThumbnails() { - return !this.configuration.options.disablePreviews + return !this.configuration?.options?.disablePreviews } }, beforeMount() { diff --git a/packages/web-app-files/src/components/SideBar/Shares/Collaborators/InviteCollaborator/InviteCollaboratorForm.vue b/packages/web-app-files/src/components/SideBar/Shares/Collaborators/InviteCollaborator/InviteCollaboratorForm.vue index 071ce5768f2..f95fcb38c02 100644 --- a/packages/web-app-files/src/components/SideBar/Shares/Collaborators/InviteCollaborator/InviteCollaboratorForm.vue +++ b/packages/web-app-files/src/components/SideBar/Shares/Collaborators/InviteCollaborator/InviteCollaboratorForm.vue @@ -143,7 +143,7 @@ export default { ...mapGetters(['configuration', 'getToken', 'user']), helpersEnabled() { - return this.configuration.options.contextHelpers + return this.configuration?.options?.contextHelpers }, inviteCollaboratorHelp() { @@ -197,7 +197,7 @@ export default { query, 'folder', 1, - this.configuration.options.sharingRecipientsPerPage + this.configuration?.options?.sharingRecipientsPerPage ) const users = recipients.exact.users diff --git a/packages/web-app-files/src/components/SideBar/Shares/FileLinks.vue b/packages/web-app-files/src/components/SideBar/Shares/FileLinks.vue index cfc8cd0e0c3..025bc6f88fe 100644 --- a/packages/web-app-files/src/components/SideBar/Shares/FileLinks.vue +++ b/packages/web-app-files/src/components/SideBar/Shares/FileLinks.vue @@ -228,7 +228,7 @@ export default defineComponent({ }, helpersEnabled() { - return this.configuration.options.contextHelpers + return this.configuration?.options?.contextHelpers }, viaLinkHelp() { diff --git a/packages/web-app-files/src/views/Favorites.vue b/packages/web-app-files/src/views/Favorites.vue index 7f000293e28..8228f44eb01 100644 --- a/packages/web-app-files/src/views/Favorites.vue +++ b/packages/web-app-files/src/views/Favorites.vue @@ -104,7 +104,7 @@ export default defineComponent({ }, displayThumbnails() { - return !this.configuration.options.disablePreviews + return !this.configuration?.options?.disablePreviews } }, diff --git a/packages/web-app-files/src/views/Personal.vue b/packages/web-app-files/src/views/Personal.vue index b55bfb21e08..f5dcbeff136 100644 --- a/packages/web-app-files/src/views/Personal.vue +++ b/packages/web-app-files/src/views/Personal.vue @@ -167,7 +167,7 @@ export default defineComponent({ }, displayThumbnails() { - return !this.configuration.options.disablePreviews + return !this.configuration?.options?.disablePreviews } }, diff --git a/packages/web-app-files/src/views/PublicFiles.vue b/packages/web-app-files/src/views/PublicFiles.vue index 085cf6735d4..900bdda4593 100644 --- a/packages/web-app-files/src/views/PublicFiles.vue +++ b/packages/web-app-files/src/views/PublicFiles.vue @@ -145,7 +145,7 @@ export default defineComponent({ }, displayThumbnails() { - return !this.configuration.options.disablePreviews + return !this.configuration?.options?.disablePreviews } }, diff --git a/packages/web-app-files/src/views/shares/SharedViaLink.vue b/packages/web-app-files/src/views/shares/SharedViaLink.vue index 0d96ddcc001..e84f54867db 100644 --- a/packages/web-app-files/src/views/shares/SharedViaLink.vue +++ b/packages/web-app-files/src/views/shares/SharedViaLink.vue @@ -104,7 +104,7 @@ export default defineComponent({ ...mapState('Files/sidebar', { sidebarClosed: 'closed' }), helpersEnabled() { - return this.configuration.options.contextHelpers + return this.configuration?.options?.contextHelpers }, quickLinkHelp() { @@ -116,7 +116,7 @@ export default defineComponent({ }, displayThumbnails() { - return !this.configuration.options.disablePreviews + return !this.configuration?.options?.disablePreviews } }, diff --git a/packages/web-app-files/src/views/shares/SharedWithMe.vue b/packages/web-app-files/src/views/shares/SharedWithMe.vue index d76bfa59bc5..d9a7eb573ea 100644 --- a/packages/web-app-files/src/views/shares/SharedWithMe.vue +++ b/packages/web-app-files/src/views/shares/SharedWithMe.vue @@ -366,7 +366,7 @@ export default defineComponent({ } }, displayThumbnails() { - return !this.configuration.options.disablePreviews && this.viewMode === ShareStatus.accepted + return !this.configuration?.options?.disablePreviews && this.viewMode === ShareStatus.accepted } }, diff --git a/packages/web-app-files/src/views/shares/SharedWithOthers.vue b/packages/web-app-files/src/views/shares/SharedWithOthers.vue index c156566a9f7..1b4e2250cb9 100644 --- a/packages/web-app-files/src/views/shares/SharedWithOthers.vue +++ b/packages/web-app-files/src/views/shares/SharedWithOthers.vue @@ -107,7 +107,7 @@ export default defineComponent({ }, displayThumbnails() { - return !this.configuration.options.disablePreviews + return !this.configuration?.options?.disablePreviews } }, diff --git a/packages/web-app-files/src/views/spaces/Project.vue b/packages/web-app-files/src/views/spaces/Project.vue index d17cae27a21..6b1841e001c 100644 --- a/packages/web-app-files/src/views/spaces/Project.vue +++ b/packages/web-app-files/src/views/spaces/Project.vue @@ -225,7 +225,7 @@ export default defineComponent({ : this.$gettext('Show less') }, displayThumbnails() { - return !this.configuration.options.disablePreviews + return !this.configuration?.options?.disablePreviews }, memberCount() { return this.space.spaceMemberIds.length diff --git a/packages/web-runtime/src/components/Topbar/TopBar.vue b/packages/web-runtime/src/components/Topbar/TopBar.vue index 519d10e100e..a556a7ab969 100644 --- a/packages/web-runtime/src/components/Topbar/TopBar.vue +++ b/packages/web-runtime/src/components/Topbar/TopBar.vue @@ -80,11 +80,11 @@ export default { }, isFeedbackLinkEnabled() { - return !this.configuration.options.disableFeedbackLink + return !this.configuration?.options?.disableFeedbackLink }, feedbackLinkOptions() { - const feedback = this.configuration.options.feedbackLink + const feedback = this.configuration?.options?.feedbackLink if (!this.isFeedbackLinkEnabled || !feedback) { return {} } diff --git a/packages/web-runtime/src/components/UploadInfo.vue b/packages/web-runtime/src/components/UploadInfo.vue index 670da1654d3..e4d730ecddd 100644 --- a/packages/web-runtime/src/components/UploadInfo.vue +++ b/packages/web-runtime/src/components/UploadInfo.vue @@ -95,7 +95,7 @@ export default { ) }, displayThumbnails() { - return !this.configuration.options.disablePreviews + return !this.configuration?.options?.disablePreviews } }, mounted() { From 171564251178ef48a9d10dd4f136e5c41cf5460d Mon Sep 17 00:00:00 2001 From: JanAckermann Date: Fri, 6 May 2022 09:54:01 +0200 Subject: [PATCH 2/2] Add changelog item --- .../bugfix-configuration-options-optional-chaining | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 changelog/unreleased/bugfix-configuration-options-optional-chaining diff --git a/changelog/unreleased/bugfix-configuration-options-optional-chaining b/changelog/unreleased/bugfix-configuration-options-optional-chaining new file mode 100644 index 00000000000..4c5b65cefce --- /dev/null +++ b/changelog/unreleased/bugfix-configuration-options-optional-chaining @@ -0,0 +1,6 @@ +Bugfix: Enable optional chaining on configuration options access + +We've optional chaining on configuration options access to prevent unwanted access on +undefined properties which might cause errors. + +https://github.com/owncloud/web/pull/6891