Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[2.0] Fixes streamed responses when using Octane #159

Merged
merged 1 commit into from
Sep 6, 2023

Conversation

joedixon
Copy link
Contributor

When using Octane of Vapor and returning a StreamedResponse such as Storage::download('my-file.png');, the file is downloaded with no content.

The following code is the issue:

$content = $response instanceof BinaryFileResponse
            ? $response->getFile()->getContent()
            : $response->getContent();

Calling getContent() on a StreamedResponse returns false and so we end up with a file with no content.

With Lambda, we can't stream directly to the client. Instead, this PR captures the content from the stream and returns it.

@joedixon joedixon changed the title Fixes streamed responses when using Octane [2.0] Fixes streamed responses when using Octane Aug 30, 2023
@joedixon joedixon marked this pull request as ready for review September 6, 2023 09:58
@joedixon joedixon merged commit 12df8de into 2.0 Sep 6, 2023
37 checks passed
@joedixon joedixon deleted the fix/octane-storage-download branch September 6, 2023 09:59
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.

1 participant