Skip to content

Commit

Permalink
🐛 Check length of OR constraints list
Browse files Browse the repository at this point in the history
  • Loading branch information
agmangas committed May 6, 2024
1 parent f65def7 commit ee341df
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion moderate_api/entities/asset/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,9 @@ async def _download_asset(
if user:
or_constraints.append(Asset.username == user.username)

stmt = stmt.where(or_(*or_constraints))
if len(or_constraints) > 0:
stmt = stmt.where(or_(*or_constraints))

result = await session.execute(stmt)
asset = result.one_or_none()

Expand Down

0 comments on commit ee341df

Please sign in to comment.