Skip to content

Commit

Permalink
fix(files): fix extension with custom displayName
Browse files Browse the repository at this point in the history
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
  • Loading branch information
skjnldsv authored and nextcloud-command committed Jul 25, 2023
1 parent 6278a12 commit b575404
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
13 changes: 10 additions & 3 deletions apps/files/src/components/FileEntry.vue
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,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-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 @@ -121,7 +121,7 @@
import { debounce } from 'debounce'
import { formatFileSize } from '@nextcloud/files'
import { Fragment } from 'vue-frag'
import { join } from 'path'
import { join, extname } from 'path'
import { showError, showSuccess } from '@nextcloud/dialogs'
import { translate } from '@nextcloud/l10n'
import CancelablePromise from 'cancelable-promise'
Expand Down Expand Up @@ -240,8 +240,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/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.

0 comments on commit b575404

Please sign in to comment.