Page MenuHomePhorge

Improve messages when no image formats are supported (due to GD not installed)
ClosedPublic

Authored by aklapper on Jan 24 2024, 10:15.
Tags
None
Referenced Files
F2188068: D25525.1715563990.diff
Sun, May 12, 01:33
Unknown Object (File)
Wed, May 8, 04:00
Unknown Object (File)
Sat, May 4, 14:23
Unknown Object (File)
Sat, May 4, 14:23
Unknown Object (File)
Sat, May 4, 13:24
Unknown Object (File)
Sat, May 4, 12:30
Unknown Object (File)
Thu, Apr 25, 22:39
Unknown Object (File)
Wed, Apr 17, 18:21

Details

Summary

When GD is not installed, trying to set a custom image for a project/blog/repository/user/etc displays unhelpful error messages (This server only supports these image formats: . and Supported formats: ) due to the array of supported image formats being empty.

Display clearer messages instead.

Closes T15720

Test Plan

Do not have php-gd installed, go to /project/manage/1/, take a look at the string below the "Upload Picture" button, select Edit Picture in the sidebar, select Custom: Choose Icon and Color..., Choose Background Color and Choose Icon, then click the Save Image button. Also try to upload a custom image and look at the error message.

Diff Detail

Repository
rP Phorge
Branch
noImgFormatsNoCry (branched from master)
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 1042
Build 1042: arc lint + arc unit

Event Timeline

I super-like the result of this in /project/manage/1/, so approved.

Bonus points:

Maybe simplify if (empty($v)) { to just if ($v) { and swapping the case

https://www.php.net/manual/en/language.types.boolean.php#language.types.boolean.casting

This revision is now accepted and ready to land.Feb 12 2024, 10:38

Maybe simplify if (empty($v)) { to just if ($v) { and swapping the case

Ahem, such comments always make me realize how my brain structure isn't necessarily a simplicity role model. :P
Yes, doing so in the next revision. Thanks!