laravel / ideas

Issues board used for Laravel internals discussions.
938 stars 28 forks source link

Adding a `Str::filename()` method to sanitze filenames #2492

Open bobmulder opened 3 years ago

bobmulder commented 3 years ago

Hi there :)

I have an usecase where I should sanitize a filename to be sure it doesn't contain chars like /, >, *, ?, et cetera.

As far I can see there is no built in method for that in Laravel, which I expected in the Str helper.

Question: is there interest to have such a method (e.g. Str::filename or Str::sanitize) in the Str helper?

Regards, Bob