Skip to content

Commit a8a9b81

Browse files
fix: limit error string for image dimension probe errors
1 parent aebc064 commit a8a9b81

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

utils/get-image-dimensions.js

+9-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,15 @@ const defaultDimensions = { width: 600, height: 400 };
55

66
const getImageDimensions = async (url, description) => {
77
try {
8-
if (url.startsWith('data:'))
9-
throw new Error('Data URI images are not supported');
8+
if (url.startsWith('data:')) {
9+
console.warn(`
10+
---------------------------------------------------------------
11+
Warning: Skipping data URL for image dimensions in ${description.substring(0, 350)}...
12+
---------------------------------------------------------------
13+
`);
14+
15+
throw new Error('Data URL');
16+
}
1017
let imageDimensions = getCache(url);
1118
if (imageDimensions) return imageDimensions;
1219

0 commit comments

Comments
 (0)