Skip to content

Regression due to #14590: images with absolute paths in JSON cause (confusing) errors #14766

@kslstn

Description

@kslstn

Astro Info

Astro                    v5.15.7
Node                     v20.19.1
System                   Linux (x64)
Package Manager          unknown
Output                   static
Adapter                  none
Integrations             @astrojs/mdx
                         @astrojs/sitemap

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

Continuing the thread at #14590.

When a JSON file used for a collection contains an image path that is treated as image() by the content layer, Astro throws an error saying the image does not exist.

The error message has an additional ./ preceding the file path. For example, this message is shown:

Could not find requested image ./src/assets/blog-placeholder-2.jpg. Does it exist?

Whereas the image path as defined in the JSON is "src/assets/blog-placeholder-2.jpg".

What's the expected result?

In previous versions, the image was found.

In v5.14.7, an error message showing the actual value from the JSON was shown:

Could not find requested image src/assets/blog-placeholder-2.jpg. Does it exist?

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-uy9ezbj7?file=src%2Fcontent.config.ts

Participation

  • I am willing to submit a pull request for this issue.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions