We are aware of the issue with the badge emails resending to everyone, we apologise for the inconvenience - learn more here.

Forum Discussion

saeeda's avatar
saeeda
New member | Level 2
3 years ago

files/list_folder/continue

Hey,
When calling files/list_folder and the has_more parameter its 'true' we make another call to /list_folder/continue with the new cursor And so on.
The problem that we faced is that the entries for every single request doesn't change, and there is something weird : the cursor is too long!
Our purpose is to collect all the folders, but for one user when I have taken a look at the network I can see more that 1000 calls to list_folder/continue endpoint.

  • Hi saeeda,

    As your code is not fully represented, may be something lefts hidden. 🤔


    saeeda wrote:
    ...
    httpService.get('/dropbox/listfolders', {"cursor": cursor})// this endpoint from our server side when the cursor !== '' then call continue
    ...

    ...


    "then call continue" - Are you sure? It looks like it's not and you are falling in infinite recursion loop. 🤷

    In case you are starting from beginning every loop step, then the list is normal to be the same, despite different cursor as result on every query! Be more careful. Check what's inside your 'get' method! Does the end point change as you have declared in comment? 🧐

  • Здравко's avatar
    Здравко
    Legendary | Level 20

    Hi saeeda,

    Hmm... 🤔 Are you updating your cursor as returned by each "file/list_folder/continue" call or are you using the one received from "file/list_folder" only? 😉

    Hope this gives idea.

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Staff rankDropbox Staff

    saeeda As Здравко mentioned, please make sure you're using the latest cursor each time, not just the original one. If something still isn't working as expected, please share the details, e.g., the steps to reproduce the issue and the code, so we can take a look.

     

    Also, can you clarify what you mean when you say "the cursor is too long"? The "cursor" value returned by /2/files/list_folder[/continue] does not have a guaranteed maximum length, and the length can vary by account, so make sure your app can accept a cursor of any length.

    • saeeda's avatar
      saeeda
      New member | Level 2
      function continueGetFoldersList(accessToken, cursor) {
      httpService.get('/dropbox/listfolders', {"cursor": cursor})// this endpoint from our server side when the cursor !== '' then call continue
      .success(function (result) {
      createFoldersTree(result.entries, false);// we use this function for filter the folders by .tag key
      if (result.has_more) continueGetFoldersList(accessToken, result.cursor);// here we send the updated cursor after success
      else loadingFolders = false;
      })
      ...

      the result I got:-
      {
      "entries": [
      {
      ".tag": "file",
      "name": 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bmex2Y8VwX-RHjuUORse6QgimmE1LyrBcM9_ki0muxWeC4s4GDV1QMWicw51NtRqPkXBkvcwwlbGh_Krh_RtkVW7599XrkpA8nid1iX70uS9wAVHN5d_kaIDbeB8Sfh5I1GQcVJg8gdJ2Pv_2nxRlRxpSoJxDALTyvf5TBXNN8RqXrgUD5lNZAVwIYNUvPeWnvIYGAkg8fzZauun0CI_Ksf667GCjPWT-95ylS4wd9iA0IiXQr4DVUIXtAapN_mhcCEUVlz3ivysle0ZGvEfcxin7w2F1PzZJ_TnU-dqSw9fpQbxqFTqY1KSPsxtB7YpjX7WlypXMHqmN5bIIKw_vBEkyoAJC7J9czCe_U2nNQ4zeCiXxRfGt5dYEQjincLIRn6PMyOvjjbtqmCyL5Rh1n_OWumj-TeTcjMiC3T-oSUCpVKM0xJaOrpTkKN4PeuR7-j1uDBlTb6zZcNYIV15RNsbkWOMyQFGWo2ABiiATMtJSWt6hmhXCj9QOHQa2Z-6eae5ZGq6pz9CAx6ezAtvLzEfdlbNwHa_hkkmsHJkv5VdK_gkvqhdxuyFKZxKBMjVRx1rg76hv0od1Wmjeh4emPXISC5YjdPRv8f81fj5m38f1NXWLnSpBmYQxK9IYd1WQhn_RXFSgP646blU9W-QDBMxOYFpSYBduVDiTai-DtaPqXLcsyqO0Niqpwk0GKuk1XBWCEw-VmFhTGH_WU4XlVlumN1cXCEoMDFv-FLuc7ZXv35PfQfbWCFTcfZFxOAlr_jnA3qu6RNjjLRashnuChmsrPk84oshFO5V-B8dEIRId1GcSI6sVSuj9Ua2niOwHuoVHVzKk9K8TXSao19YaKKWa1VcuC5xSUKanEMh5zZ_QDEmPtR-AQN",
      "has_more": true
      }

      and on each response we got a new cursor  but the same entries!

      • Здравко's avatar
        Здравко
        Legendary | Level 20

        Hi saeeda,

        As your code is not fully represented, may be something lefts hidden. 🤔


        saeeda wrote:
        ...
        httpService.get('/dropbox/listfolders', {"cursor": cursor})// this endpoint from our server side when the cursor !== '' then call continue
        ...

        ...


        "then call continue" - Are you sure? It looks like it's not and you are falling in infinite recursion loop. 🤷

        In case you are starting from beginning every loop step, then the list is normal to be the same, despite different cursor as result on every query! Be more careful. Check what's inside your 'get' method! Does the end point change as you have declared in comment? 🧐