flarum / issue-archive

0 stars 0 forks source link

Can't upload ico favicons #73

Open SychO9 opened 3 years ago

SychO9 commented 3 years ago

Bug Report

Current Behavior ico favicons cannot no longer be uploaded.

Steps to Reproduce

  1. Go to Dashboard Apearence page.
  2. Upload ico favicon.
  3. Notice it errors out with a 500.

Environment

Possible Solution An abstract UploadImage controller class was introduced in beta 15, the makeImage method is expected to return a Intervention\Image\Image object, which is not the case for ico files where we return the file stream, this is because the GD extension used by intervention, does not support ico files.

https://github.com/flarum/core/blob/a077ae9ca36a8ad0adc25042118ba2407feaa5fe/src/Api/Controller/UploadFaviconController.php#L29-L42

We could remove the explicit typehint on the makeImage method, but that would break extensions, so the best thing to do is to throw a validation error on ico images in 1.x (since there is no way to fix this without making breaking changes) and we can fix the issue for 2.0

Additional Context Relevant PR: flarum/framework#2477