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
}
}
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.
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
Reproducible Steps And Demo
Simply feed this url into the
getImageMetaData
function: https://www.instagram.com/reel/C49E_fuvM90/