fix(files): fix extension with custom displayName

Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
This commit is contained in:
John Molakvoæ (skjnldsv) 2023-07-25 11:29:38 +02:00 committed by nextcloud-command
parent 6278a12c94
commit b575404a94
3 changed files with 13 additions and 6 deletions

View file

@ -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>
@ -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'
@ -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)

4
dist/files-main.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long