Skip to content

fix: don't crash generate when a contributor's avatar_url is not an absolute URL - #572

Merged
jdalrymple merged 1 commit into
all-contributors:mainfrom
VincentBorgers:fix/avatar-url-without-host
Oct 13, 2026
Merged

jdalrymple merged 1 commit into
all-contributors:mainfrom
VincentBorgers:fix/avatar-url-without-host

Conversation

@VincentBorgers

Copy link
Copy Markdown
Contributor

What:

Fixes all-contributors generate crashing with TypeError: Invalid URL when a contributor's avatar_url is missing or not an absolute URL, for example a relative path to an image in the repository. This came in with #466, so it affects the 6.27.0 release candidate. 6.26.1 generates these entries without an error.

TypeError: Invalid URL
    at formatContributor (file:///.../src/generate/format-contributor.js:55:32)
  code: 'ERR_INVALID_URL',

Real configs have such entries. datalad/datalad-next and flux-framework/flux-restful-api each have a contributor whose avatar_url is [null]. With the .all-contributorsrc from datalad-next, 6.26.1 renders all 12 contributors and main throws.

Why:

#466 adds the image size with new URL(contributor.avatar_url), which throws for anything that is not an absolute URL, so a single entry like this stops the whole table from being generated.

How:

The size parameter is only added when URL.canParse() accepts the avatar URL. Other values go to the template unchanged, as before #466. The new test for a relative avatar URL fails on main with the same TypeError and passes with this change. npm test (115 tests) and npm run lint pass.

Checklist:

  • Documentation N/A
  • Tests
  • Ready to be merged
  • Added myself to contributors table

@JimMadge
JimMadge requested a review from jdalrymple October 8, 2026 13:51

@JimMadge JimMadge left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks @VincentBorgers 🎉

This looks good to me.
I'm not sure if avatars from a local path are expected, but I don't see a reason to break support when it worked in the past and especially as projects are already using that.

@jdalrymple could you have a look as this touches your changes?

@jdalrymple

Copy link
Copy Markdown
Contributor

Thanks @VincentBorgers 🎉

This looks good to me. I'm not sure if avatars from a local path are expected, but I don't see a reason to break support when it worked in the past and especially as projects are already using that.

@jdalrymple could you have a look as this touches your changes?

LGTM!

@jdalrymple
jdalrymple merged commit 0b2f461 into all-contributors:main Oct 13, 2026
6 checks passed
@JimMadge

Copy link
Copy Markdown
Member

@allcontributors please add @VincentBorgers for code, bug

@allcontributors

Copy link
Copy Markdown
Contributor

@JimMadge

I've put up a pull request to add @VincentBorgers! 🎉

@JimMadge

Copy link
Copy Markdown
Member

@allcontributors please add @jdalrymple for review

@allcontributors

Copy link
Copy Markdown
Contributor

@JimMadge

I've put up a pull request to add @jdalrymple! 🎉

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