Skip to content

Commit

Permalink
fix(quotes): properly check for author id
Browse files Browse the repository at this point in the history
This commit solves an issue where author existence check was not performed if author id was 0 (zero) - a falsy value. Now it checks only for None
  • Loading branch information
zobweyt authored Jan 11, 2025
1 parent d45e090 commit 2d0ae1a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/api/quotes/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def create_quote(
quote_service: QuoteServiceDepends,
author_service: AuthorServiceDepends,
):
if args.author_id and not author_service.get_author_by_id(args.author_id):
if args.author_id is not None and not author_service.get_author_by_id(args.author_id):
raise HTTPException(status.HTTP_404_NOT_FOUND, _("No author found with the ID '%s'." % (args.author_id,)))
return quote_service.create_quote(args, created_by_user_id=current_user.id)

Expand Down

0 comments on commit 2d0ae1a

Please sign in to comment.