Protect against no valid assets selected

This commit is contained in:
Eric Bailey
2025-08-14 12:22:47 -05:00
parent 5a99ae973d
commit b554a388b5
@@ -185,6 +185,12 @@ function classifyImagePickerAsset(asset: ImagePickerAsset):
type = 'image'
}
console.log({
asset,
type,
mimeType,
})
/*
* If we weren't able to find a valid type, we don't support this asset.
*/
@@ -301,6 +307,7 @@ async function processImagePickerAssets(
})
}
if (supportedAssets.length > 0) {
if (selectableAssetType === 'image') {
if (supportedAssets.length > selectionCountRemaining) {
errors.add(SelectedAssetError.MaxImages)
@@ -350,6 +357,7 @@ async function processImagePickerAssets(
supportedAssets = supportedAssets.slice(0, 1)
}
}
}
return {
type: selectableAssetType!, // set above