]> source.dussan.org Git - nextcloud-server.git/commitdiff
refactor(files): Fix nullish operator usage and add missing code comment
authorFerdinand Thiessen <opensource@fthiessen.de>
Thu, 13 Jun 2024 13:07:06 +0000 (15:07 +0200)
committerFerdinand Thiessen <opensource@fthiessen.de>
Mon, 24 Jun 2024 10:53:53 +0000 (12:53 +0200)
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
apps/files/src/components/FileEntry/FileEntryActions.vue
apps/files/src/components/FileEntryMixin.ts
apps/files/src/utils/hashUtils.ts

index d0306e5e848e366cb0f5400929323037bb08da8f..3df4289b1a0011688904873d5c62b9e9515f15d8 100644 (file)
@@ -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
index 407df14fa7c7e1380622618cc997877da951e05c..d3ae1511936bad9ac6ebed5becc9efda137e9475 100644 (file)
@@ -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)
index 607064947a8bee132f6327c567c2a4d9c2622daf..2e1fadff067c1d8e9337b1377dd0dee7a9deefd3 100644 (file)
@@ -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++) {