Skip to content

Commit 53d9f83

Browse files
susnuxAndyScherzinger
authored andcommitted
fix(files): Do not split filename into base and extension for folders
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
1 parent 30ea2b0 commit 53d9f83

File tree

4 files changed

+17
-14
lines changed

4 files changed

+17
-14
lines changed

apps/files/src/components/FileEntry.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
@click.native="execDefaultAction" />
5252

5353
<FileEntryName ref="name"
54-
:display-name="displayName"
54+
:basename="basename"
5555
:extension="extension"
5656
:files-list-width="filesListWidth"
5757
:nodes="nodes"

apps/files/src/components/FileEntry/FileEntryName.vue

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@
4646
v-bind="linkTo.params">
4747
<!-- File name -->
4848
<span class="files-list__row-name-text">
49-
<!-- Keep the displayName stuck to the extension to avoid whitespace rendering issues-->
50-
<span class="files-list__row-name-" v-text="displayName" />
49+
<!-- Keep the filename stuck to the extension to avoid whitespace rendering issues-->
50+
<span class="files-list__row-name-" v-text="basename" />
5151
<span class="files-list__row-name-ext" v-text="extension" />
5252
</span>
5353
</component>
@@ -81,10 +81,16 @@ export default Vue.extend({
8181
},
8282
8383
props: {
84-
displayName: {
84+
/**
85+
* The filename without extension
86+
*/
87+
basename: {
8588
type: String,
8689
required: true,
8790
},
91+
/**
92+
* The extension of the filename
93+
*/
8894
extension: {
8995
type: String,
9096
required: true,
@@ -172,7 +178,7 @@ export default Vue.extend({
172178
params: {
173179
download: this.source.basename,
174180
href: this.source.source,
175-
title: t('files', 'Download file {name}', { name: this.displayName }),
181+
title: t('files', 'Download file {name}', { name: `${this.basename}${this.extension}` }),
176182
tabindex: '0',
177183
},
178184
}

apps/files/src/components/FileEntryGrid.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
@click.native="execDefaultAction" />
5454

5555
<FileEntryName ref="name"
56-
:display-name="displayName"
56+
:basename="basename"
5757
:extension="extension"
5858
:files-list-width="filesListWidth"
5959
:grid-mode="true"

apps/files/src/components/FileEntryMixin.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -83,18 +83,15 @@ export default defineComponent({
8383
return this.source.status === NodeStatus.LOADING
8484
},
8585

86-
extension() {
87-
if (this.source.attributes?.displayname) {
88-
return extname(this.source.attributes.displayname)
89-
}
90-
return this.source.extension || ''
91-
},
86+
/**
87+
* The display name of the current node
88+
* Either the nodes filename or a custom display name (e.g. for shares)
89+
*/
9290
displayName() {
9391
const ext = this.extension
9492
const name = String(this.source.attributes.displayname || this.source.basename)
9593

96-
// Strip extension from name if defined
97-
return !ext ? name : name.slice(0, 0 - ext.length)
94+
return extname(this.displayName)
9895
},
9996

10097
draggingFiles() {

0 commit comments

Comments
 (0)