IMatch.selectedFolders selects all files in db - bug?

Started by ubacher, July 14, 2017, 01:12:42 PM

Previous topic - Next topic

ubacher

I tried getting the files in the selected folders using this code:
Quotefunction getAllFiles() {
                IMWS.get('v1/files', {
                    idlist: IMatch.selectedFolders,
                    fields: 'id,filename,name,namene,ext'
                }).then(function (response) {
                    allfiles = response.files;
                    console.log(JSON.stringify(response, null, 2))
.......
                   
This returns all the files in the db. The selected folder has only 23 files. Am I doing something wrong?

Mario

idlist: IMatch.selectedFolders,

is wrong. This idlist does not exist. And as a fallback IMatch returns all files.
Look carefully at the name. and then check again in the documentation of the IMatch class.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

ubacher

I find in Imatchlib.js:

   selectedFolders : '@imatch.selectedFolders',

I tried IMatch.idlist.focusedFiles, / and also '@imatch.selectedFolders',

Mario

It is always IMatch.idlist...
I will analyze this over the weekend. IMatch.idlist.selectedFolders should work for the folders/files endpoint, but not for /files.
/files expects a list of file ids, not folder ids.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook