Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable27] fix(files): sanitize name and ext display #39333

Merged
merged 1 commit into from
Jul 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions apps/files/src/components/FileEntry.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@
</span>

<!-- File name -->
<span class="files-list__row-name-text">{{ displayName }}</span>
<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-name" v-text="displayName" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use the mustache notation everywhere else, sure we want to mix with the v-text notation?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, because otherwise we have whitespace in the output too.
Vue does NOT trim whitespace. And for this specific example, we want to have none rendered. :)

<span class="files-list__row-name-ext" v-text="source.extension" />
</span>
</a>
</td>

Expand Down Expand Up @@ -237,8 +241,12 @@ export default Vue.extend({
return this.source?.fileid?.toString?.()
},
displayName() {
return this.source.attributes.displayName
|| this.source.basename
const ext = (this.source.extension || '')
const name = (this.source.attributes.displayName
|| this.source.basename)

// Strip extension from name if defined
return !ext ? name : name.slice(0, 0 - ext.length)
},

size() {
Expand Down
6 changes: 6 additions & 0 deletions apps/files/src/components/FilesListVirtual.vue
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,12 @@ export default Vue.extend({
// Make some space for the outline
padding: 5px 10px;
margin-left: -10px;
// Align two name and ext
display: inline-flex;
}

.files-list__row-name-ext {
color: var(--color-text-maxcontrast);
}
}

Expand Down
4 changes: 2 additions & 2 deletions dist/files-main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/files-main.js.map

Large diffs are not rendered by default.

Loading