Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't pull avatar if remote GitHub Enterprise uses private mode. #532

Merged
merged 5 commits into from
May 3, 2022

Conversation

Vlatombe
Copy link
Member

@Vlatombe Vlatombe commented Apr 6, 2022

Description

When defining a GitHub organization pointing at a Github Enterprise instance running in private mode, the avatar URL can't be accessed directly. This is causing a broken icon to be displayed as well as layout problems in list view in recent Jenkins versions.

This patch detects if the remote instance is in private mode and fallbacks to the standard github icon in that case.
The organization folder needs to be saved after upgrading to apply the new logic.

Before
Capture d’écran 2022-04-06 à 11 58 39

After
Capture d’écran 2022-04-06 à 14 59 49

Submitter checklist

  • Link to JIRA ticket in description, if appropriate.
  • Change is code complete and matches issue description
  • Automated tests have been added to exercise the changes
  • Reviewer's manual test instructions provided in PR description. See Reviewer's first task below.

Reviewer checklist

  • Run the changes and verify that the change matches the issue description
  • Reviewed the code
  • Verified that the appropriate tests have been written or valid explanation given

Documentation changes

  • Link to jenkins.io PR, or an explanation for why no doc changes are needed

Users/aliases to notify

@jtnord jtnord requested a review from a team April 8, 2022 11:43
Copy link
Member

@jtnord jtnord left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this would be clearer if exceptions where not used to control the flow - especially for the majority use case.

} catch (MalformedURLException e) {
// Ignored
} catch (IOException e) {
if (e.getMessage().contains("private mode enabled")) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jtnord
Copy link
Member

jtnord commented Apr 8, 2022

Looking at this again - I do not think this is even the correct fix and only fixes half the issue (if the other half is fixed then this is not needed at all).

Basically the image is not loaded so the browser is falling back to what it should do - the "alt text" (which is "GitHub Organisation")

if image loading is disabled you will see exactly the same issue against the public github.com (shown here for ci.jenkins.io)

image

The issue would seem to be that the alt text is too wide for the column (and the column is not resizing) to accommodate it.

@Vlatombe Vlatombe requested a review from jtnord April 8, 2022 15:09
@car-roll
Copy link
Contributor

Looks like there hasn't been an incremental generated since the first commit. Apparently they are just spotless errors 😞

@car-roll car-roll added the bug label May 3, 2022
@car-roll car-roll merged commit 9fb798a into jenkinsci:master May 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants