FriendsOfFlarum / upload

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

Access violation in mime type map #205

Closed omergoktas closed 5 months ago

omergoktas commented 4 years ago

https://github.com/FriendsOfFlarum/upload/blob/60bd5ead414893b39d03dd0748e54dae190afded/src/Commands/UploadHandler.php#L87 I think there should be a check for the key 'mime' in the map uploadFileData before accessing the value since the map returned from getFileType() might be empty. I'm getting an error when uploading some png file:

[error] 321#321: *176 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: mime in /opt/flarum/vendor/fof/upload/src/Commands/UploadHandler.php on line 87" while reading response header from upstream

I don't know whether its a valid situation or not to have files with unknown mime types. Or maybe my setup is not well built thus it cannot read mime types of images.

clarkwinkelmann commented 4 years ago

I can't find where the documentation for the mimeDetector says how we are supposed to read that array https://github.com/SoftCreatR/php-mime-detector#usage

@imorland you might want to take a look at this ?

DavideIadeluca commented 5 months ago

@omergoktas Are you still running into the same issue on the latest version of fof/upload?

omergoktas commented 5 months ago

@omergoktas Are you still running into the same issue on the latest version of fof/upload?

This was sometime ago, I don't have flarum anymore. I can close the issue if you like.