diff options
author | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-07-22 17:54:54 +0200 |
---|---|---|
committer | skjnldsv <skjnldsv@protonmail.com> | 2024-08-02 10:03:03 +0200 |
commit | 8d00d46350cd74f0a80f73f17bed4fb3bb4ad195 (patch) | |
tree | 821efbd442ed20eae4ed9b906df8ea6376fd2124 /apps/files/src | |
parent | aec506870c48eb2c664fffa22a3b1cb5b391886d (diff) | |
download | nextcloud-server-8d00d46350cd74f0a80f73f17bed4fb3bb4ad195.tar.gz nextcloud-server-8d00d46350cd74f0a80f73f17bed4fb3bb4ad195.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')
-rw-r--r-- | apps/files/src/components/FileEntry.vue | 2 | ||||
-rw-r--r-- | apps/files/src/components/FileEntry/FileEntryName.vue | 14 | ||||
-rw-r--r-- | apps/files/src/components/FileEntryGrid.vue | 2 | ||||
-rw-r--r-- | apps/files/src/components/FileEntryMixin.ts | 13 |
4 files changed, 17 insertions, 14 deletions
diff --git a/apps/files/src/components/FileEntry.vue b/apps/files/src/components/FileEntry.vue index b3929ebb10e..e93b8882be0 100644 --- a/apps/files/src/components/FileEntry.vue +++ b/apps/files/src/components/FileEntry.vue @@ -51,7 +51,7 @@ @click.native="execDefaultAction" /> <FileEntryName ref="name" - :display-name="displayName" + :basename="basename" :extension="extension" :files-list-width="filesListWidth" :nodes="nodes" diff --git a/apps/files/src/components/FileEntry/FileEntryName.vue b/apps/files/src/components/FileEntry/FileEntryName.vue index 8289df1f958..5543b05436a 100644 --- a/apps/files/src/components/FileEntry/FileEntryName.vue +++ b/apps/files/src/components/FileEntry/FileEntryName.vue @@ -46,8 +46,8 @@ v-bind="linkTo.params"> <!-- File name --> <span class="files-list__row-name-text"> - <!-- Keep the displayName stuck to the extension to avoid whitespace rendering issues--> - <span class="files-list__row-name-" v-text="displayName" /> + <!-- Keep the filename stuck to the extension to avoid whitespace rendering issues--> + <span class="files-list__row-name-" v-text="basename" /> <span class="files-list__row-name-ext" v-text="extension" /> </span> </component> @@ -81,10 +81,16 @@ export default Vue.extend({ }, props: { - displayName: { + /** + * The filename without extension + */ + basename: { type: String, required: true, }, + /** + * The extension of the filename + */ extension: { type: String, required: true, @@ -172,7 +178,7 @@ export default Vue.extend({ params: { download: this.source.basename, href: this.source.source, - title: t('files', 'Download file {name}', { name: this.displayName }), + title: t('files', 'Download file {name}', { name: `${this.basename}${this.extension}` }), tabindex: '0', }, } diff --git a/apps/files/src/components/FileEntryGrid.vue b/apps/files/src/components/FileEntryGrid.vue index b2e98a80d9e..e33c93c2987 100644 --- a/apps/files/src/components/FileEntryGrid.vue +++ b/apps/files/src/components/FileEntryGrid.vue @@ -53,7 +53,7 @@ @click.native="execDefaultAction" /> <FileEntryName ref="name" - :display-name="displayName" + :basename="basename" :extension="extension" :files-list-width="filesListWidth" :grid-mode="true" diff --git a/apps/files/src/components/FileEntryMixin.ts b/apps/files/src/components/FileEntryMixin.ts index 5c5a806b97c..f645b1f5df0 100644 --- a/apps/files/src/components/FileEntryMixin.ts +++ b/apps/files/src/components/FileEntryMixin.ts @@ -83,18 +83,15 @@ export default defineComponent({ return this.source.status === NodeStatus.LOADING }, - extension() { - if (this.source.attributes?.displayname) { - return extname(this.source.attributes.displayname) - } - return this.source.extension || '' - }, + /** + * The display name of the current node + * Either the nodes filename or a custom display name (e.g. for shares) + */ displayName() { const ext = this.extension const name = String(this.source.attributes.displayname || this.source.basename) - // Strip extension from name if defined - return !ext ? name : name.slice(0, 0 - ext.length) + return extname(this.displayName) }, draggingFiles() { |