schroffl / teamspeak-filesystem

Node module to interface with the teamspeak filesystem
https://www.npmjs.com/package/teamspeak-filesystem
MIT License
1 stars 0 forks source link

Multiple files error #1

Open frct1 opened 6 years ago

frct1 commented 6 years ago

Hi, @schroffl find a error. Method getFiles throw an error if we have one more files (icons for examples) on list.name.map function. I've replace that to

'getFiles': (cid, path, cpw) => {
        return query.send('ftgetfilelist', { cid, 'cpw': cpw || '', path })
            .then(list => typeof list.name === 'string' ? 
                [ { 'name': list.name, 'path': list.path, 'size': list.size, 'datetime': list.datetime, 'type': list.type == 1 ? 'file' : 'dir' } ] : 
                list.map((file, i) => ({ 'name': file.name, path: list.path, 'size': file.size, 'datetime': file.datetime, 'type': file.type == 1 ? 'file' : 'dir'})) );
    },

Works fine

p.s* but file path show normal on first item in object

[ { name: 'icon_1074977208',
    path: '/icons',
    size: '607',
    datetime: '1530958000',
    type: 'file' },
  { name: 'icon_1397428609',
    path: undefined,
    size: '886',
    datetime: '1530958001',
    type: 'file' } ] 
schroffl commented 6 years ago

What error are you getting?

frct1 commented 6 years ago

currently not at home and can not get to the development resources, but the following error Cannot read property map of undefined