Skip to content

Conversation

yallxe
Copy link

@yallxe yallxe commented Jun 6, 2025

This PR implements GET /recordings/stored/{recordingName}/file ARI request.


This change is Reviewable

Copy link
Member

@Ulexus Ulexus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your submission; I just have one concern regarding the functionality of Download with respect to closing the request's Body. I have made an inline suggestion, but let me know your thoughts.


// Download retrieves the data for the stored recording
// IMPORTANT: Don't forget to close the reader when done.
func (sr *StoredRecording) Download(key *ari.Key) (*ari.StoredRecordingBinaryData, error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This presents a quandary: it's too easy to forget to close the body's ReadCloser.

I see three ways to mitigate this, each with their own trade-offs:

  • rename Download to ReadCloser, in an attempt to make it clear that it must be Closed
  • take an io.Writer as a second parameter to Download()
  • store the download to a temp file

Personally, I think the safest and cleanest is to pass in an io.Writer; let the caller indicate where the data should go, so it can just be Piped directly there, and we can close the Body within Download.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants