Bluesky app fork with some witchin' additions 💫

Fix video aspect ratio error - "Record/embed/aspectRatio/width cannot be less than 1" (#8571)

authored by samuel.fm and committed by

GitHub bde3fdaa 494758da

+17 -5
+16 -4
src/lib/api/index.ts
··· 333 333 return {lang: caption.lang, file: data.blob} 334 334 }), 335 335 ) 336 + 337 + // lexicon numbers must be floats 338 + const width = Math.round(videoDraft.asset.width) 339 + const height = Math.round(videoDraft.asset.height) 340 + 341 + // aspect ratio values must be >0 - better to leave as unset otherwise 342 + // posting will fail if aspect ratio is set to 0 343 + const aspectRatio = width > 0 && height > 0 ? {width, height} : undefined 344 + 345 + if (!aspectRatio) { 346 + logger.error( 347 + `Invalid aspect ratio - got { width: ${videoDraft.asset.width}, height: ${videoDraft.asset.height} }`, 348 + ) 349 + } 350 + 336 351 return { 337 352 $type: 'app.bsky.embed.video', 338 353 video: videoDraft.pendingPublish.blobRef, 339 354 alt: videoDraft.altText || undefined, 340 355 captions: captions.length === 0 ? undefined : captions, 341 - aspectRatio: { 342 - width: videoDraft.asset.width, 343 - height: videoDraft.asset.height, 344 - }, 356 + aspectRatio, 345 357 } 346 358 } 347 359 if (embedDraft.media?.type === 'gif') {
+1 -1
src/view/com/composer/videos/pickVideo.ts
··· 1 1 import { 2 - ImagePickerAsset, 2 + type ImagePickerAsset, 3 3 launchImageLibraryAsync, 4 4 UIImagePickerPreferredAssetRepresentationMode, 5 5 } from 'expo-image-picker'