elixir-cloud-aai / proTES

Proxy service for injecting middleware into GA4GH TES requests
Apache License 2.0
5 stars 6 forks source link

fix: Handle None Values Correctly in List Task Endpoint Query Filter #177

Closed Ayush5120 closed 1 month ago

Ayush5120 commented 2 months ago

When building the query filter with potential None values for name_prefix and user_id, the filter should be adjusted accordingly to avoid incorrect queries.

Expected Behavior:

Actual Behavior: Currently, if name_prefix is None, the filter becomes: filter_dict = {'task_original.name': {'$regex': '^None'}}

while in the case of None Type the filter_dict should be empty likefilter_dict = {} The actual issue is here:

        name_prefix: str = str(kwargs.get("name_prefix"))

        if name_prefix is not None:
            filter_dict["task_original.name"] = {"$regex": f"^{name_prefix}"}

and, filter_dict["user_id"] = kwargs.get("user_id")