Skip to content

Commit b4c0137

Browse files
authored
Merge pull request #709 from jrchamp/fix/get_recording_url_list-error-handling
webservice: get_recording_url_list error handling
2 parents 5d33d5b + c299967 commit b4c0137

1 file changed

Lines changed: 19 additions & 2 deletions

File tree

classes/webservice.php

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1135,9 +1135,26 @@ public function get_recording_url_list($meetingid) {
11351135
// Classic: recording:read:admin.
11361136
// Granular: cloud_recording:read:list_recording_files:admin.
11371137
$url = 'meetings/' . $this->encode_uuid($meetingid) . '/recordings';
1138-
$response = $this->make_call($url);
11391138

1140-
if (!empty($response->recording_files)) {
1139+
try {
1140+
$response = $this->make_call($url);
1141+
} catch (not_found_exception $e) {
1142+
// If the meeting was not found (1001) or there are no recordings (3301), return an empty array.
1143+
return [];
1144+
}
1145+
1146+
if (empty($response->recording_files)) {
1147+
if (!isset($response->recording_count)) {
1148+
throw new bad_request_exception('recording_count: undefined', 400);
1149+
}
1150+
1151+
$recordingcount = (int) $response->recording_count;
1152+
$audiocount = count($response->participant_audio_files);
1153+
if ($recordingcount !== $audiocount) {
1154+
// If there are no recording files and the recording count does not match, throw an exception.
1155+
throw new bad_request_exception("recording_count: $recordingcount != participant_audio_files: $audiocount", 400);
1156+
}
1157+
} else {
11411158
foreach ($response->recording_files as $recording) {
11421159
$url = $recording->play_url ?? $recording->download_url ?? null;
11431160
if (!empty($url) && isset($allowedrecordingtypes[$recording->file_type])) {

0 commit comments

Comments
 (0)