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

actually really fix download_url end point for perl releases #1187

Merged
merged 1 commit into from
Apr 26, 2024

Conversation

haarg
Copy link
Member

@haarg haarg commented Apr 26, 2024

No description provided.

my $module
= $hit->{inner_hits}{module}
? $hit->{inner_hits}{module}{hits}{hits}[0]{_source}
: {};
Copy link
Member

Choose a reason for hiding this comment

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

probably always want to add a $module //= {} as we are going to dereference it later

Copy link
Member Author

Choose a reason for hiding this comment

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

The ES query that would produce {inner_hits}{module} requires a module with a matching name. If inner_hits exists, {inner_hits}{module}{hits}{hits}[0]{_source} will always exist.

? $hit->{inner_hits}{module}{hits}{hits}[0]{_source}
: {};

return +{ %$source, %$module, @checksums, };
Copy link
Member

Choose a reason for hiding this comment

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

note that $source can be undef

Copy link
Member Author

Choose a reason for hiding this comment

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

At this point, we have verified that there was a result in $hit. We are requesting specific _source fields. Even if none of those fields are available, _source will still exist unless Elasticsearch is entirely broken. $source can not be undef.

@oalders oalders merged commit 6bf88ac into master Apr 26, 2024
2 checks passed
@oalders oalders deleted the haarg/fix-fix-download_url-perl branch April 26, 2024 15:58
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