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

[master] fix(files): fix extension with custom displayName #39656

Merged
merged 1 commit into from
Aug 3, 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
12 changes: 10 additions & 2 deletions apps/files/src/components/FileEntry.vue
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
<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" />
<span class="files-list__row-name-ext" v-text="source.extension" />
<span class="files-list__row-name-ext" v-text="extension" />
</span>
</a>
</td>
Expand Down Expand Up @@ -157,6 +157,7 @@ import { debounce } from 'debounce'
import { emit } from '@nextcloud/event-bus'
import { formatFileSize, Permission } from '@nextcloud/files'
import { Fragment } from 'vue-frag'
import { extname } from 'path'
import { showError, showSuccess } from '@nextcloud/dialogs'
import { translate } from '@nextcloud/l10n'
import { generateUrl } from '@nextcloud/router'
Expand Down Expand Up @@ -290,8 +291,15 @@ export default Vue.extend({
fileid() {
return this.source?.fileid?.toString?.()
},

extension() {
if (this.source.attributes?.displayName) {
return extname(this.source.attributes.displayName)
}
return this.source.extension || ''
},
displayName() {
const ext = (this.source.extension || '')
const ext = this.extension
const name = (this.source.attributes.displayName
|| this.source.basename)

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

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

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.

4 changes: 2 additions & 2 deletions dist/files_sharing-files_sharing_tab.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/files_sharing-files_sharing_tab.js.map

Large diffs are not rendered by default.

Loading