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

Related endpoint returns 500 if the main item is not found in ES index #3349

Closed
obulat opened this issue Nov 14, 2023 · 2 comments · Fixed by #3552
Closed

Related endpoint returns 500 if the main item is not found in ES index #3349

obulat opened this issue Nov 14, 2023 · 2 comments · Fixed by #3552
Labels
💻 aspect: code Concerns the software code in the repository 🛠 goal: fix Bug fix help wanted Open to participation from the community 🟨 priority: medium Not blocking but should be addressed soon 🧱 stack: api Related to the Django API

Comments

@obulat
Copy link
Contributor

obulat commented Nov 14, 2023

Problem

For the related endpoint, we first search for the item in ES index to get its title, tags and creator.

item_hit = item_search.query(Term(identifier=uuid)).execute().hits[0]

When the identifier part of the URL matches the UUID regex, but there's no media item with such an identifier, this request doesn't return anything, so this request returns 500 ("Could not find items"). It should return 404 instead, using raise APIException("Not found.", 404)

Description

If the ES request does not return the item, we should return a 404 error.

@obulat obulat added help wanted Open to participation from the community 🟨 priority: medium Not blocking but should be addressed soon 🛠 goal: fix Bug fix 💻 aspect: code Concerns the software code in the repository 🧱 stack: api Related to the Django API labels Nov 14, 2023
@ngken0995
Copy link
Collaborator

@obulat This might be related to #3520. Here is a comment @dhruvkb wrote. link

@obulat
Copy link
Contributor Author

obulat commented Jan 2, 2024

You're right, @ngken0995. Thank you for catching this.
Fixed by #3552.

@obulat obulat closed this as completed Jan 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💻 aspect: code Concerns the software code in the repository 🛠 goal: fix Bug fix help wanted Open to participation from the community 🟨 priority: medium Not blocking but should be addressed soon 🧱 stack: api Related to the Django API
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants