Gracefully handle non-image files for getImageMetaData (currently crashes the app on iOS)
Current behavior
Currently if you feed a file that is not an image into getImageMetaData, the app hard crashes. I was using this function to test if a url was an image or not.
export async function isValidImage(url: string) {
try {
// Check if the fetched data is an image
const imageData = await getImageMetaData(url)
return imageData.extension !== "unknown"Ï
} catch (error) {
console.log("IMAGE ERROR", error)
return false
}
}
Expected behavior
The function returns an extension of "unknown".
Platform
Works on android but not on iOS.
React Native Version
"react-native": "0.73.6",
React Native Compressor Version
"react-native-compressor": "^1.8.23",
Reproducible Steps And Demo
Simply feed this url into the getImageMetaData function: https://www.instagram.com/reel/C49E_fuvM90/
👋 @ChristopherGabba Thanks for opening your issue here! If you find this package useful hit the star🌟!
This issue is stale because it has been open 365 days with no activity. Remove stale label or comment or this will be closed in 7 days.
This issue was closed because it has been stalled for 7 days with no activity.