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

Remove old craft generated temp files #380

Merged

Conversation

sjeng
Copy link

@sjeng sjeng commented May 19, 2023

Description

Craft temporary directory gets filled up with image files when ImageOptimize plugin is enabled.

After some debugging, it looks like Craft creates a copy of the image in the temp directory before firing off the EVENT_TRANSFORM_IMAGE event, and sends the path to the file as the tempPath property of the event object. Craft then pulls the path back out after any attached eventhandlers have done their thing, and finishes up any house cleaning tasks.

The issue is that ImageOptimize creates its own file in the temp directory, and replaces the tempPath property with the updated path. Craft then uses the path generated by the plugin for the rest of the process. The old temp file that was created by Craft is orphaned and fills up the temp directory.

This PR is to make sure that the orphaned temp files get deleted so they don't stick around.

@sjeng sjeng requested a review from khalwat as a code owner May 19, 2023 18:56
@khalwat
Copy link
Contributor

khalwat commented May 19, 2023

Thanks! I will roll this into the v3 version as well

@khalwat khalwat merged commit 04f2493 into nystudio107:develop-v4 May 19, 2023
khalwat added a commit that referenced this pull request May 19, 2023
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