Repository navigation
Delete the files uploaded with each request - #219
Merged
Merged
Conversation
the Psr15Handler already do it with Psr7Bridge::cleanupUploadedFiles() but the OctaneHandler never call it, so the uploads stay in /tmp until the lambda instance is recycled
Symfony's HttpFoundationFactory moves every file Bref uploads to a new temporary file named "symfony*", so Psr7Bridge::cleanupUploadedFiles(), which deletes "bref_upload_*" files, never found them. The non-Octane HttpHandler did not call the cleanup either. Bref 3.0.13 is required: before it, the cleanup missed every upload on PHP 8.4 and up.
Member
Author
|
Tested in prod |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Takes over #218 by @felipehertzer, whose commit is kept as is.
Files uploaded to a Laravel application running with Octane were never deleted: they stayed in the Lambda instance's
/tmpuntil it was full, and then everything that writes to/tmpfailed (including Laravel's storage, which is in/tmpon Lambda).#218 calls Bref's
Psr7Bridge::cleanupUploadedFiles()when a request starts, like Bref'sPsr15Handlerdoes. That was not enough on its own:HttpFoundationFactorymoves every file Bref uploads to a new temporary file namedsymfony*(the file is not a native PHP upload), so the cleanup, which deletesbref_upload_*files, never found it.SymfonyRequestBridgenow names those files with Bref's prefix.tempnam()adds 19 random characters instead of 6, and Bref's cleanup only matched 6: fixed in Bref 3.0.13 (Delete uploaded files on PHP 8.4 and up bref#2218), which is now required.Bref\LaravelBridge\Http\HttpHandler, the handler without Octane, goes through the same bridge and did not call the cleanup either.The
SymfonyRequestBridgetest fails without the renaming, and the handler tests fail without the cleanup call. They pass on macOS and on Linux with PHP 8.4.