Skip to content

$search in on_get_messages does not work #6

@marlemion

Description

@marlemion

If I retreive messages with a query, i.e.:

api/gc/v1/me/mailFolders/AAAAAG55cVcpA0rYlYKRcCRup8YBAAAAAwAAAMwL-82Ny0ZQud98sYamzIAAAAAA/messages?$top=1000&$search=subject%3DYour

The list of messages is generated. However, the nextlink looks like that:

api/gc/v1/me/mailFolders/AAAAAG55cVcpA0rYlYKRcCRup8YBAAAAAwAAAMwL-82Ny0ZQud98sYamzIAAAAAA/messages?$top=1000&$search=subject%3DYour&$skip=1000

Here, the 'skip' part is ignored. Hence, with this link, again all messages are retrieved. Normally, one has to write a function checking for the nextlink. If the the nextlink returns values, check again for the next nextlink and so on, until the returned value is empty. As in this case, the value never will be empty, the function will never end.

This works with plain api/gc/v1/me/mailFolders/AAAAAG55cVcpA0rYlYKRcCRup8YBAAAAAwAAAMwL-82Ny0ZQud98sYamzIAAAAAA/messages?$top=1000

The culprit seems to lie in backend/kopano/resource.py, in particular in folder_gen, where for queries a yielder() function is provided to replace the actual folder.items generator. count is set 0. But event with a correct count of the generator (i.e. via count = len([item for item in folder.items(quer=query)) the problem remains. I have tried to implement a lambda expression here but was not successful.

This is a pity, as it prevents filtering messages in mailfolders.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions