Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Fix) Broken api compatbility when no torrents found & next page not being null #4214

Merged
merged 2 commits into from
Oct 10, 2024

Conversation

Roardom
Copy link
Collaborator

@Roardom Roardom commented Oct 8, 2024

There was always a null check here to return 404 when no torrents are found. But this null check was always comparing against a paginator instance... which would never be true. So when I changed it to an isEmpty when I changed the query from a database query to a meilisearch query, and thought that was the correct thing to do to make sure a 404 is still returned, that was incorrect, because a 404 was never returned in the first place. An empty array is proper here.

There was always a null check here to return 404 when no torrents are found. But this null check was always comparing against a paginator instance... which would never be true. So when I changed it to an isEmpty when I changed the query from a database query to a meilisearch query, and thought that was the correct thing to do to make sure a 404 is still returned, that was incorrect, because a 404 was never returned in the first place. An empty array is proper here.
Copy link

what-the-diff bot commented Oct 8, 2024

PR Summary

  • Centralized Torrents' Response Handling
    Consolidated repeated code to simplify response generation for torrent requests.

  • Consistent Response for SQL Permission States
    Shifted the response for torrent requests outside control statements allowing more streamlined output whether SQL operations are allowed or not.

  • Structured Non-SQL Response
    Refined torrent data response when SQL is not permissible, ensuring systematic pagination and data processing.

  • Preserved Link Creation in Closure
    Retained the creation of download and magnet links pertinent to torrents within the specific function block, ensuring their effective generation.

@Roardom Roardom changed the title (Fix) Broken api compatbility when no torrents found (Fix) Broken api compatbility when no torrents found & next page not being null Oct 8, 2024
@HDVinnie HDVinnie merged commit 370860d into HDInnovations:8.x.x Oct 10, 2024
5 checks passed
@HDVinnie HDVinnie deleted the fix-api-when-no-results branch October 10, 2024 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants