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 deletion of files without extension #3664

Merged
merged 1 commit into from
Jul 15, 2024

Conversation

cbaconnier
Copy link
Contributor

@cbaconnier cbaconnier commented Jul 9, 2024

Tests are failing in Laravel apps when using fake images generated by UploadedFile::fake()->image('image.jpg') as the file will be generated internally by tmpfile() and will be named (E.g.) phpGoZkJ9

Currently, it looks if the path contains the filename, including the dot: phpGoZkJ9.

I changed it to match the full filename after the forward slash /
From my understanding, the $path will always have a forward slash (/) before the filename.

If there's a case where doesn't have a forward slash or uses double backslashes \\ (because Windows),I will happily update my PR to include corresponding scenarios and tests.

Thanks!

@cbaconnier
Copy link
Contributor Author

I'm wondering why is there a foreach and a check without the extension though.
Can a file have multiple extension without being itself a conversion or a responsive image?

@freekmurze freekmurze merged commit 38174fd into spatie:main Jul 15, 2024
9 checks passed
@freekmurze
Copy link
Member

Thanks!

@cbaconnier cbaconnier deleted the fix-file-remover branch November 27, 2024 06:57
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