File tree 2 files changed +11
-1
lines changed
packages/astro/src/assets
2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' astro ' : patch
3
+ ---
4
+
5
+ fix: improve error message when inferSize is used in local images with the Image component
Original file line number Diff line number Diff line change
1
+ import { isRemotePath } from '@astrojs/internal-helpers/path' ;
1
2
import type { AstroConfig } from '../@types/astro.js' ;
2
3
import { AstroError , AstroErrorData } from '../core/errors/index.js' ;
3
4
import { DEFAULT_HASH_PROPS } from './consts.js' ;
@@ -65,7 +66,11 @@ export async function getImage(
65
66
} ;
66
67
67
68
// Infer size for remote images if inferSize is true
68
- if ( options . inferSize && isRemoteImage ( resolvedOptions . src ) ) {
69
+ if (
70
+ options . inferSize &&
71
+ isRemoteImage ( resolvedOptions . src ) &&
72
+ isRemotePath ( resolvedOptions . src )
73
+ ) {
69
74
const result = await inferRemoteSize ( resolvedOptions . src ) ; // Directly probe the image URL
70
75
resolvedOptions . width ??= result . width ;
71
76
resolvedOptions . height ??= result . height ;
You can’t perform that action at this time.
0 commit comments