Skip to content

Commit f6d3451

Browse files
committed
fix(files): sanitize name and ext display
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
1 parent 789f027 commit f6d3451

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

apps/files/src/components/FileEntry.vue

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,11 @@
5959
</span>
6060

6161
<!-- File name -->
62-
<span class="files-list__row-name-text">{{ displayName }}</span>
62+
<span class="files-list__row-name-text">
63+
<!-- Keep the displayName stuck to the extension to avoid whitespace rendering issues-->
64+
<span class="files-list__row-name-name" v-text="displayName" />
65+
<span class="files-list__row-name-ext" v-text="source.extension" />
66+
</span>
6367
</a>
6468
</td>
6569

@@ -237,8 +241,12 @@ export default Vue.extend({
237241
return this.source?.fileid?.toString?.()
238242
},
239243
displayName() {
240-
return this.source.attributes.displayName
241-
|| this.source.basename
244+
const ext = (this.source.extension || '')
245+
const name = (this.source.attributes.displayName
246+
|| this.source.basename)
247+
248+
// Strip extension from name if defined
249+
return !ext ? name : name.slice(0, 0 - ext.length)
242250
},
243251
244252
size() {

apps/files/src/components/FilesListVirtual.vue

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,12 @@ export default Vue.extend({
299299
// Make some space for the outline
300300
padding: 5px 10px;
301301
margin-left: -10px;
302+
// Align two name and ext
303+
display: inline-flex;
304+
}
305+
306+
.files-list__row-name-ext {
307+
color: var(--color-text-maxcontrast);
302308
}
303309
}
304310

0 commit comments

Comments
 (0)