Skip to content

widgets: Fix some issues#1900

Merged
Priya5 merged 5 commits into
blackducksoftware:stagingfrom
mattst88:widget-fixes
Jun 25, 2026
Merged

widgets: Fix some issues#1900
Priya5 merged 5 commits into
blackducksoftware:stagingfrom
mattst88:widget-fixes

Conversation

@mattst88

Copy link
Copy Markdown
Contributor
  • widgets: correct OH_Partner_frame.png dimensions, metadata, and test fixtures
  • widgets: correct Tiny widget height to match profile_tiny.png (15 → 16)
  • widgets: add PNG output format support
    `?format=gif` actually emits a PNG but with a Content-Type of image/gif.
    
    So add `?format=png` which will emit the same underlying image data as
    before but with the correct Content-Type of image/png.
    
  • widgets: flatten transparent background to white
    OH_Partner_frame.png has an alpha channel — the content area was
    transparent. The kudos badge composited on top has a white background,
    making it visually inconsistent. Flatten to white so the entire widget
    has a uniform opaque background.
    

@mattst88

Copy link
Copy Markdown
Contributor Author

cc: @Priya5

@mattst88

mattst88 commented Jun 4, 2026

Copy link
Copy Markdown
Contributor Author

Can someone review this? It's pretty trivial.

cc: @Niharika1117

@Niharika1117

Copy link
Copy Markdown
Contributor

Hi @mattst88 , Sorry for the late reply. We will review your PR this week and let you know.

@mattst88

Copy link
Copy Markdown
Contributor Author

Are there questions? Is there something unclear? Is something difficult to review?

I've update all the commit summaries with explanations of what the problem is and what the fix is.

Please... just respond and ask a question if there are concerns?

@Priya5

Priya5 commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

@mattst88

Copy link
Copy Markdown
Contributor Author

Done.

@Priya5

Priya5 commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

mattst88 added 4 commits June 18, 2026 10:22
…fixtures

OH_Partner_frame.png had a 1px transparent row at y=0, so all visible
content started at y=1. This caused the rendered Detailed widget to
appear shifted down with an empty row at the top and the bottom pixel
clipped off.

The Detailed widget model also reported width: 230 but the frame image
is 232px wide, causing the HTML embed <img width="230"> to clip 2px off
the right edge.

Test fixtures regenerated to match the corrected frame.
profile_tiny.png is 80×16 but the Tiny widget model reported height: 15,
causing the HTML embed <img height="15"> to scale the image down by 1px
vertically.
Widget image generation produces PNG internally — the pipeline opens
OH_Partner_frame.png, composites text and kudos onto it, and returns the
result via MiniMagick's to_blob, which emits PNG bytes. Previously those
bytes were served as image/gif regardless of what was requested, which
is a lie about the Content-Type.

Add proper ?format=png support by renaming render_image_for_gif_format
to render_image_for_image_format (and the "not supported" equivalent)
across all five widget controllers. PNG requests now receive
Content-Type: image/png with the same underlying bytes — no conversion
needed since the data is already PNG. GIF requests preserve existing
behavior for backward compatibility.
OH_Partner_frame.png has an alpha channel — the right-side content area
where name, commits, and kudos are composited was transparent rather
than opaque white. The kudos laurel badge composited on top has a white
background, making the two visually inconsistent: the laurel shows white
while surrounding areas are transparent, appearing as a checkerboard in
image viewers or taking on the page background color in browsers.

Add image.flatten to setup_blank in badge_helper.rb. flatten fills
transparent pixels with the current background color, which is already
set to white on the line above, producing a fully opaque image before
any compositing begins. setup_blank is shared by all three badge types
(Account, Partner, Thin), so all affected test fixtures are regenerated.
@mattst88

Copy link
Copy Markdown
Contributor Author

Done.

Faker-generated org names with special characters (e.g. apostrophes)
create broken regexes when passed as strings to must_match. Use
must_include instead, which does plain substring matching.
@mattst88

Copy link
Copy Markdown
Contributor Author

Can we land this now?

@Priya5

Priya5 commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Can we land this now?

We will push this to production tomorrow, Thursday, June 25.

@Priya5 Priya5 changed the base branch from main to staging June 24, 2026 12:00
@Priya5 Priya5 merged commit 4952188 into blackducksoftware:staging Jun 25, 2026
1 check passed
Priya5 pushed a commit that referenced this pull request Jun 25, 2026
* widgets: correct OH_Partner_frame.png dimensions, metadata, and test fixtures

OH_Partner_frame.png had a 1px transparent row at y=0, so all visible
content started at y=1. This caused the rendered Detailed widget to
appear shifted down with an empty row at the top and the bottom pixel
clipped off.

The Detailed widget model also reported width: 230 but the frame image
is 232px wide, causing the HTML embed <img width="230"> to clip 2px off
the right edge.

Test fixtures regenerated to match the corrected frame.

* widgets: correct Tiny widget height to match profile_tiny.png (15 → 16)

profile_tiny.png is 80×16 but the Tiny widget model reported height: 15,
causing the HTML embed <img height="15"> to scale the image down by 1px
vertically.

* widgets: add PNG output format support

Widget image generation produces PNG internally — the pipeline opens
OH_Partner_frame.png, composites text and kudos onto it, and returns the
result via MiniMagick's to_blob, which emits PNG bytes. Previously those
bytes were served as image/gif regardless of what was requested, which
is a lie about the Content-Type.

Add proper ?format=png support by renaming render_image_for_gif_format
to render_image_for_image_format (and the "not supported" equivalent)
across all five widget controllers. PNG requests now receive
Content-Type: image/png with the same underlying bytes — no conversion
needed since the data is already PNG. GIF requests preserve existing
behavior for backward compatibility.

* widgets: flatten transparent background to white

OH_Partner_frame.png has an alpha channel — the right-side content area
where name, commits, and kudos are composited was transparent rather
than opaque white. The kudos laurel badge composited on top has a white
background, making the two visually inconsistent: the laurel shows white
while surrounding areas are transparent, appearing as a checkerboard in
image viewers or taking on the page background color in browsers.

Add image.flatten to setup_blank in badge_helper.rb. flatten fills
transparent pixels with the current background color, which is already
set to white on the line above, producing a fully opaque image before
any compositing begins. setup_blank is shared by all three badge types
(Account, Partner, Thin), so all affected test fixtures are regenerated.

* positions: use must_include instead of must_match for org name

Faker-generated org names with special characters (e.g. apostrophes)
create broken regexes when passed as strings to must_match. Use
must_include instead, which does plain substring matching.
Priya5 pushed a commit that referenced this pull request Jun 25, 2026
* widgets: correct OH_Partner_frame.png dimensions, metadata, and test fixtures

OH_Partner_frame.png had a 1px transparent row at y=0, so all visible
content started at y=1. This caused the rendered Detailed widget to
appear shifted down with an empty row at the top and the bottom pixel
clipped off.

The Detailed widget model also reported width: 230 but the frame image
is 232px wide, causing the HTML embed <img width="230"> to clip 2px off
the right edge.

Test fixtures regenerated to match the corrected frame.

* widgets: correct Tiny widget height to match profile_tiny.png (15 → 16)

profile_tiny.png is 80×16 but the Tiny widget model reported height: 15,
causing the HTML embed <img height="15"> to scale the image down by 1px
vertically.

* widgets: add PNG output format support

Widget image generation produces PNG internally — the pipeline opens
OH_Partner_frame.png, composites text and kudos onto it, and returns the
result via MiniMagick's to_blob, which emits PNG bytes. Previously those
bytes were served as image/gif regardless of what was requested, which
is a lie about the Content-Type.

Add proper ?format=png support by renaming render_image_for_gif_format
to render_image_for_image_format (and the "not supported" equivalent)
across all five widget controllers. PNG requests now receive
Content-Type: image/png with the same underlying bytes — no conversion
needed since the data is already PNG. GIF requests preserve existing
behavior for backward compatibility.

* widgets: flatten transparent background to white

OH_Partner_frame.png has an alpha channel — the right-side content area
where name, commits, and kudos are composited was transparent rather
than opaque white. The kudos laurel badge composited on top has a white
background, making the two visually inconsistent: the laurel shows white
while surrounding areas are transparent, appearing as a checkerboard in
image viewers or taking on the page background color in browsers.

Add image.flatten to setup_blank in badge_helper.rb. flatten fills
transparent pixels with the current background color, which is already
set to white on the line above, producing a fully opaque image before
any compositing begins. setup_blank is shared by all three badge types
(Account, Partner, Thin), so all affected test fixtures are regenerated.

* positions: use must_include instead of must_match for org name

Faker-generated org names with special characters (e.g. apostrophes)
create broken regexes when passed as strings to must_match. Use
must_include instead, which does plain substring matching.
@mattst88 mattst88 deleted the widget-fixes branch July 2, 2026 02:22
@mattst88

mattst88 commented Jul 2, 2026

Copy link
Copy Markdown
Contributor Author

We will push this to production tomorrow, Thursday, June 25.

As far as I can tell, this has not happened, a week later.

https://openhub.net/accounts/mattst88/widgets/account_detailed?format=gif&ref=sample still shows the extra row at the top of the image.

And in dark mode https://github.com/mattst88/mattst88 still shows the transparent background, which makes the text unreadable.

This has been a very poor experience contributing to this project.

@Priya5

Priya5 commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Hi @mattst88 ,

Thank you for checking back in. I sincerely apologize for the delay and the experience. Your contribution is important to us.
We tried to deploy the fix last week. However, an unrelated issue blocked the deployment. We are still investigating that blocker.
Once we resolve it, we will deploy your changes and confirm here immediately. Apologies again for not updating you sooner. We will keep you posted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants