Bluesky app fork with some witchin' additions 💫

Merge pull request #3201 from bluesky-social/samuel/handle-invalid-files

Filter out non-image files from image picker

authored by samuel.fm and committed by

GitHub 44b3a37f f1d55f49

+14 -7
+14 -7
src/lib/media/picker.shared.ts
··· 18 18 Toast.show('You may only select up to 4 images') 19 19 } 20 20 21 - return (response.assets ?? []).slice(0, 4).map(image => ({ 22 - mime: 'image/jpeg', 23 - height: image.height, 24 - width: image.width, 25 - path: image.uri, 26 - size: getDataUriSize(image.uri), 27 - })) 21 + return (response.assets ?? []) 22 + .slice(0, 4) 23 + .filter(asset => { 24 + if (asset.mimeType?.startsWith('image/')) return true 25 + Toast.show('Only image files are supported') 26 + return false 27 + }) 28 + .map(image => ({ 29 + mime: 'image/jpeg', 30 + height: image.height, 31 + width: image.width, 32 + path: image.uri, 33 + size: getDataUriSize(image.uri), 34 + })) 28 35 }