Skip to content

prepareCrosswalk updates #1619

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

vnessamartinez
Copy link
Contributor

No description provided.

@vnessamartinez
Copy link
Contributor Author

The following error shows up when a column is blank in a row in a crosswalk file. It looks for an asset at the path in the column, but when the field is blank, it throws an error because it doesn't exist. For example, this repo has a crosswalk that has both png and jpg images, in that order. When the png field is blank because there is something in the jpg column instead, Baker throws the following error. This PR adds a check for it to first check that there is something in the field before looking for the path.
Screenshot 2025-03-26 at 9 55 05 AM

@@ -361,8 +361,10 @@ export class Baker extends EventEmitter {
return;
}

preppedData.assets[normalizedAssetType][normalizedAssetName][ext] =
this.getStaticPath(path);
if (path && path.length > 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

just check if (path), this will catch undefined, null, and empty strings. If there is no path we should show an error or warning. So code should look like:

if (!path) {
  console.error(`Could not find static path for asset :${normalizedAssetName} and path: ${path}`);
  return;
}

preppedData.assets[normalizedAssetType][normalizedAssetName][ext] = this.getStaticPath(path);

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