spatie / laravel-medialibrary

Associate files with Eloquent models
https://spatie.be/docs/laravel-medialibrary
MIT License
5.78k stars 1.08k forks source link

Adjust sanitization of PHP file extensions in `FileAdder.php` #3681

Closed rmdavi closed 3 months ago

rmdavi commented 3 months ago

I recently noticed sporadically failing tests in my application after the addition of PHP extensions to the defaultSanitizer() function of FileAdder.php.

Digging into the issue, it turns out the tempnam() call in addMediaFromBase64() of InteractsWithMedia.php was occasionally ending the file name string with PHp which was blocked by the PHP extension check.

This PR proposes to add the . to all $phpExtensions in the list to resolve the issue.

freekmurze commented 3 months ago

Nice, thank you!