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

Fix media-library:clean command when using custom path generators #2925

Merged
merged 2 commits into from
May 19, 2022

Conversation

YellowFish085
Copy link
Contributor

This PR fixes #2922 that I opened myself (this is a personal account, the account used to open the PR is my professional account).

Two modifications were done in this PR:

1.

The path generator used by the media-library:clean command is now dynamically created in the deleteConversionFilesForDeprecatedConversions method for each processed media using the PathGeneratorFactory.

This modification allows custom path generators configured via the media-library.custom_path_generators to actually be used by the command and not only the DefaultPathGenerator included in this package, and consequently for conversions saved in custom path to be properly deleted.

2.

Following this change, another issue came to light where the original image would be deleted if the path for conversions is configured to be the same as the original image path.

A new check was added to the deleteConversionFilesForDeprecatedConversions method to ensure that the original image is not mistakenly considered as a deprecated conversion and deleted.


Side note: This is my first PR to open source project and I'm not really familiar with tests, so I hope the changes included in this PR are satisfying enough.

@freekmurze
Copy link
Member

Thank you!

@petsoukos
Copy link
Contributor

Will this make it into v9 or older versions dont get support ?

@freekmurze
Copy link
Member

We don't actively support the older versions anymore, but we would still accept and merge PRs for bug fixes.

@petsoukos
Copy link
Contributor

😞
I wish I knew Pest so I could do a PR for v9. I'm tied into v9 without the possibility to upgrade to Laravel 9 for the foreseeable future. For now I will have to fiddle with it in the vendors directory since I rarely need this feature.

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.

Command media-library:clean does not use custom path generators
4 participants