Skip to content

Commit

Permalink
getRecordings: fix bug in getRecordings endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilippKilian committed Jun 13, 2024
1 parent 4cbceab commit 6613f23
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions b3lb/rest/classes/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ def allowed_methods(self) -> List[Literal["GET", "POST", "DELETE", "PATCH", "PUT

def filter_recordings(self, meeting_id: str = "", recording_id: str = "") -> QuerySet[Record]:
if self.state and self.state not in ["unpublished", "published"]:
return QuerySet(model=Record) # return empty QuerySet if state isn't in allowed states
return Record.objects.none() # return empty QuerySet if state isn't in allowed states

query = Q(record_set__secret=self.secret)

Expand All @@ -344,14 +344,12 @@ def filter_recordings(self, meeting_id: str = "", recording_id: str = "") -> Que
UUID(recording_id)
query &= Q(uuid=recording_id)
except ValueError:
return QuerySet(model=Record) # return empty QuerySet for BadRequest
return Record.objects.none() # return empty QuerySet for BadRequest

if meeting_id:
try:
UUID(meeting_id)
query %= Q(record_set__meta_meeting_id=meeting_id)
except ValueError:
return QuerySet(model=Record) # return empty QuerySet for BadRequest
if meeting_id and 2 <= len(self.meeting_id) <= cst.MEETING_ID_LENGTH:
query &= Q(record_set__meta_meeting_id=meeting_id)
elif meeting_id:
return Record.objects.none() # return empty QuerySet for BadRequest

if self.state == "published":
query &= Q(published=True)
Expand Down

0 comments on commit 6613f23

Please sign in to comment.