Skip to content

Image wrongly cached #14500

@Its-Just-Nans

Description

@Its-Just-Nans

Astro Info

Astro                    v5.13.8
Vite                     v6.3.6
Node                     v22.13.0
System                   Linux (x64)
Package Manager          npm
Output                   static
Adapter                  none
Integrations             none

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

All

Describe the Bug

During build I you have

src/
     imgs/
         folder1/
               image.webp
         folder2/
               image.webp

Both image.webp are exaclty the same

In my code I use some image but in different components with <img src={img.src} /> or with background url as inlined css

During build, the image will be optimized only once

 ▶ /_astro/image.CbqfUwcl_Zmidpi.webp (reused cache entry) (+3ms) (15/34)

but in the code both image will not have the correct filename

  • <img src="/_astro/image.CbqfUwcl_Zmidpi.webp" ....
  • ...background-image: url(/_astro/image.CbqfUwcl.webp);...

What's the expected result?

In the code both link should be correct and link to the image

Note: if i change the image it does not happen

cannot reproduce on stackblitz

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-hqqzmlsc-bw3vqhnu

Participation

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    - P3: minor bugAn edge case that only affects very specific usage (priority)feat: assetsRelated to the Assets feature (scope)pkg: astroRelated to the core `astro` package (scope)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions