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

fix(images): Fix empty frontmatter keys crashing Astro #6480

Closed
wants to merge 2 commits into from

Conversation

Princesseuh
Copy link
Member

Changes

This would've never had happened in Rust

Fix #6469

Testing

Added one. That fixture gets built, so the build will fail if we don't handle this correctly. We could test in the dev server too presumably, but it's the same codepath either ways...

Docs

N/A

@changeset-bot
Copy link

changeset-bot bot commented Mar 9, 2023

🦋 Changeset detected

Latest commit: 2000ce0

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added the pkg: astro Related to the core `astro` package (scope) label Mar 9, 2023
Copy link
Contributor

@bholmesdev bholmesdev left a comment

Choose a reason for hiding this comment

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

objectively perfect

@@ -46,7 +46,7 @@ export const msg = {
export function extractFrontmatterAssets(data: Record<string, any>): string[] {
function findAssets(potentialAssets: Record<string, any>): ImageMetadata[] {
return Object.values(potentialAssets).reduce((acc, curr) => {
if (typeof curr === 'object') {
if (typeof curr === 'object' && !Array.isArray(curr) && curr !== null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Gotta love checking if things are really actually truly objects huh 😓

@Princesseuh
Copy link
Member Author

Superseded by #6483

@Princesseuh Princesseuh closed this Mar 9, 2023
@Princesseuh Princesseuh deleted the fix/image-empty-frontmatter branch July 18, 2023 16:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: astro Related to the core `astro` package (scope)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Astro build crashes if any front matter fields are null
3 participants