FriendsOfFlarum / upload

The file upload extension with insane intelligence for your Flarum forum.
https://discuss.flarum.org/d/4154
MIT License
176 stars 96 forks source link

File Upload Names #345

Closed OfficialAudite closed 1 year ago

OfficialAudite commented 1 year ago

I need to keep the name when downloading since it is ment for csgo maps and maps are with _ but the upload system replaces it with - and it does not work. Is there a way to fix it or change it ?

luceos commented 1 year ago

Check discord, implemented a hook and provided an example.

(new Extend\Event())
        ->listen(
            \FoF\Upload\Events\File\IsSlugged::class,
            fn (\FoF\Upload\Events\File\IsSlugged $event) => $event->slug = pathinfo($event->file->getClientOriginalName(), PATHINFO_FILENAME)
        ),