flarum / framework

Simple forum software for building great communities.
http://flarum.org/
6.36k stars 835 forks source link

White avatar image throws javascript errors on profile page #2714

Closed clarkwinkelmann closed 3 years ago

clarkwinkelmann commented 3 years ago

Bug Report

Current Behavior Setting a completely white image as an avatar results in this.getPalette(...) is null errors thrown in the javascript console.

I don't think this will interfere with the page rendering, because it happens inside of the async onload callback in https://github.com/flarum/core/blob/9627eb73f103fae4dff1680cc5f972277db6cae7/js/src/common/models/User.js#L93

but it floods the console with errors.

Steps to Reproduce

  1. Create a completely white PNG image of any width and height (other formats might also work)
  2. Set as avatar
  3. Observe error in console for both the user itself and guests visiting the profile

Expected Behavior The error should be silenced.

Environment

Possible Solution Ideally this should be fixed or better handled in the color-thief library so we don't need to catch a null error from inside their library.

However there are issues opened about this on their repo since 2015 and there doesn't seem to be much activity.

I have added a comment to the older of the issues I could find https://github.com/lokesh/color-thief/issues/40

If ColorThief doesn't make any change, the easiest solution for us would probably be to just catch and silence any error that results from calling ColorThief.

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. We do this to keep the amount of open issues to a manageable minimum. In any case, thanks for taking an interest in this software and contributing by opening the issue in the first place!