diff options
author | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-06-13 15:07:06 +0200 |
---|---|---|
committer | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-06-24 12:53:53 +0200 |
commit | 3782142f5996720fd68935b7073923fe658508cd (patch) | |
tree | f97e66f50e8f655855e6786c32b0056f18322689 /apps/files/src | |
parent | d4352fe2ffdafca2e662ddc7f9e7ec8b7eb3bb4a (diff) | |
download | nextcloud-server-3782142f5996720fd68935b7073923fe658508cd.tar.gz nextcloud-server-3782142f5996720fd68935b7073923fe658508cd.zip |
refactor(files): Fix nullish operator usage and add missing code comment
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Diffstat (limited to 'apps/files/src')
-rw-r--r-- | apps/files/src/components/FileEntry/FileEntryActions.vue | 3 | ||||
-rw-r--r-- | apps/files/src/components/FileEntryMixin.ts | 4 | ||||
-rw-r--r-- | apps/files/src/utils/hashUtils.ts | 5 |
3 files changed, 8 insertions, 4 deletions
diff --git a/apps/files/src/components/FileEntry/FileEntryActions.vue b/apps/files/src/components/FileEntry/FileEntryActions.vue index d0306e5e848..3df4289b1a0 100644 --- a/apps/files/src/components/FileEntry/FileEntryActions.vue +++ b/apps/files/src/components/FileEntry/FileEntryActions.vue @@ -90,10 +90,9 @@ import NcActionSeparator from '@nextcloud/vue/dist/Components/NcActionSeparator. import NcIconSvgWrapper from '@nextcloud/vue/dist/Components/NcIconSvgWrapper.js' import NcLoadingIcon from '@nextcloud/vue/dist/Components/NcLoadingIcon.js' import ArrowLeftIcon from 'vue-material-design-icons/ArrowLeft.vue' - -import { useNavigation } from '../../composables/useNavigation' import CustomElementRender from '../CustomElementRender.vue' +import { useNavigation } from '../../composables/useNavigation' import logger from '../../logger.js' // The registered actions list diff --git a/apps/files/src/components/FileEntryMixin.ts b/apps/files/src/components/FileEntryMixin.ts index 407df14fa7c..d3ae1511936 100644 --- a/apps/files/src/components/FileEntryMixin.ts +++ b/apps/files/src/components/FileEntryMixin.ts @@ -50,14 +50,14 @@ export default defineComponent({ computed: { currentDir() { // Remove any trailing slash but leave root slash - return (this.$route?.query?.dir?.toString() || '/').replace(/^(.+)\/$/, '$1') + return (this.$route.query?.dir?.toString() || '/').replace(/^(.+)\/$/, '$1') }, currentFileId() { return this.$route.params?.fileid || this.$route.query?.fileid || null }, fileid() { - return this.source?.fileid + return this.source.fileid ?? 0 }, uniqueId() { return hashCode(this.source.source) diff --git a/apps/files/src/utils/hashUtils.ts b/apps/files/src/utils/hashUtils.ts index 607064947a8..2e1fadff067 100644 --- a/apps/files/src/utils/hashUtils.ts +++ b/apps/files/src/utils/hashUtils.ts @@ -3,6 +3,11 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ +/** + * Simple non-secure hashing function similar to Java's `hashCode` + * @param str The string to hash + * @return {number} a non secure hash of the string + */ export const hashCode = function(str: string): number { let hash = 0 for (let i = 0; i < str.length; i++) { |