diff options
author | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-07-22 17:54:54 +0200 |
---|---|---|
committer | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-07-25 01:24:26 +0200 |
commit | 5dc8e06014f1f8b7197ec6bf8c030b4978f23da2 (patch) | |
tree | dce5dbad3f4dae1e39e9f2686930452027613689 /apps/files/src/components/FileEntryMixin.ts | |
parent | f95d8263f68192bf9376127695238ce19c09f9e6 (diff) | |
download | nextcloud-server-5dc8e06014f1f8b7197ec6bf8c030b4978f23da2.tar.gz nextcloud-server-5dc8e06014f1f8b7197ec6bf8c030b4978f23da2.zip |
fix(files): Do not split filename into `base` and `extension` for folders
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Diffstat (limited to 'apps/files/src/components/FileEntryMixin.ts')
-rw-r--r-- | apps/files/src/components/FileEntryMixin.ts | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/apps/files/src/components/FileEntryMixin.ts b/apps/files/src/components/FileEntryMixin.ts index 6c0b278c61b..da9b93107c7 100644 --- a/apps/files/src/components/FileEntryMixin.ts +++ b/apps/files/src/components/FileEntryMixin.ts @@ -74,19 +74,31 @@ export default defineComponent({ return this.source.status === NodeStatus.LOADING }, - extension() { - if (this.source.attributes?.displayname) { - return extname(this.source.attributes.displayname) + /** + * The display name of the current node + * Either the nodes filename or a custom display name (e.g. for shares) + */ + displayName() { + return this.source.displayname + }, + /** + * The display name without extension + */ + basename() { + if (this.extension === '') { + return this.displayName } - return this.source.extension || '' + return this.displayName.slice(0, 0 - this.extension.length) }, - displayName() { - const ext = this.extension - const name = String(this.source.attributes.displayname - || this.source.basename) + /** + * The extension of the file + */ + extension() { + if (this.source.type === FileType.Folder) { + return '' + } - // Strip extension from name if defined - return !ext ? name : name.slice(0, 0 - ext.length) + return extname(this.displayName) }, draggingFiles() { |