File tree Expand file tree Collapse file tree 4 files changed +12
-11
lines changed
Expand file tree Collapse file tree 4 files changed +12
-11
lines changed Original file line number Diff line number Diff line change @@ -177,7 +177,7 @@ function validate() {
177177
178178<template >
179179 <fieldset :class =" $style.pickerEntry" >
180- <legend >{{ existing.basename }}</legend >
180+ <legend >{{ existing.displayname }}</legend >
181181
182182 <!-- Incoming file -->
183183 <NcCheckboxRadioSwitch
Original file line number Diff line number Diff line change @@ -59,7 +59,7 @@ const node = new File({
5959 mime : 'text/plain' ,
6060 source : 'https://example.com/remote.php/dav/alice/a.txt' ,
6161 root : '/' ,
62- attributes : { displayName : 'test' } ,
62+ attributes : { displayname : 'test' } ,
6363} )
6464
6565const folder = new Folder ( {
@@ -69,7 +69,7 @@ const folder = new Folder({
6969 source : 'https://example.com/remote.php/dav/alice/b' ,
7070 root : '/' ,
7171 permissions : Permission . ALL ,
72- attributes : { displayName : 'test folder' } ,
72+ attributes : { displayname : 'test folder' } ,
7373} )
7474
7575const folderNonReadable = new Folder ( {
@@ -79,7 +79,7 @@ const folderNonReadable = new Folder({
7979 source : 'https://example.com/remote.php/dav/alice/b' ,
8080 root : '/' ,
8181 permissions : Permission . ALL & ~ Permission . READ ,
82- attributes : { displayName : 'test folder' } ,
82+ attributes : { displayname : 'test folder' } ,
8383} )
8484
8585const defaultOptions = {
Original file line number Diff line number Diff line change 4949import type { INode } from ' @nextcloud/files'
5050
5151import { FileType , formatFileSize , Permission } from ' @nextcloud/files'
52+ import { extname } from ' @nextcloud/paths'
5253import { computed } from ' vue'
5354import NcCheckboxRadioSwitch from ' @nextcloud/vue/components/NcCheckboxRadioSwitch'
5455import NcDateTime from ' @nextcloud/vue/components/NcDateTime'
@@ -80,14 +81,14 @@ const emit = defineEmits<{
8081const timestamp = computed (() => props .node .mtime ?? 0 )
8182
8283/**
83- * The displayname of the current node (excluding file extension)
84+ * The file extension of the file
8485 */
85- const displayName = computed (() => props . node . attributes ?. displayName || props . node . basename . slice ( 0 , props .node .extension ? - props . node . extension . length : undefined ))
86+ const fileExtension = computed (() => extname ( props .node .displayname ))
8687
8788/**
88- * The file extension of the file
89+ * The displayname of the current node (excluding file extension)
8990 */
90- const fileExtension = computed (() => props .node .extension )
91+ const displayName = computed (() => props .node .displayname . slice ( 0 , fileExtension . value ? - fileExtension . value . length : undefined ) )
9192
9293/**
9394 * Check if the node is a directory
Original file line number Diff line number Diff line change @@ -211,13 +211,13 @@ export class FilePickerBuilder<IsMultiSelect extends boolean> {
211211 public setType ( type : FilePickerType ) {
212212 this . buttons = ( nodes , path ) => {
213213 const buttons : IFilePickerButton [ ] = [ ]
214- const node = nodes ?. [ 0 ] ?. attributes ?. displayName || nodes ?. [ 0 ] ?. basename
215- const target = node || basename ( path )
214+ const node = nodes [ 0 ]
215+ const target = node ?. displayname || basename ( path )
216216
217217 if ( type === FilePickerType . Choose ) {
218218 let label = t ( 'Choose' )
219219 if ( nodes . length === 1 ) {
220- label = t ( 'Choose {file}' , { file : node } )
220+ label = t ( 'Choose {file}' , { file : target } )
221221 } else if ( this . multiSelect ) {
222222 label = n ( 'Choose %n file' , 'Choose %n files' , nodes . length )
223223 }
You can’t perform that action at this time.
0 commit comments