Fix Drive video upload to Shopify

- Detect video mime types in MediaService to set correct resource ('VIDEO') and mediaContentType.

- Add fileSize to stagedUploadsCreate payload as required by Shopify for videos.

- Add safety check for missing upload targets to prevent crashes.

- Implement getSize in MockDriveService.

- Add unit test in MediaService.test.ts to verify correct resource and fileSize handling for video uploads.

- Update mock in mediaManager.integration.test.ts to support getSize().
This commit is contained in:
Ben Miller
2025-12-29 01:17:06 -07:00
parent e5ce154175
commit 19b3d5de2b
4 changed files with 59 additions and 2 deletions

View File

@ -52,6 +52,7 @@ export class MockDriveService implements IDriveService {
getThumbnail: () => ({ getBytes: () => [] }),
getMimeType: () => (blob as any).getContentType ? (blob as any).getContentType() : "image/jpeg",
getDownloadUrl: () => `https://drive.google.com/uc?export=download&id=${id}`,
getSize: () => blob.getBytes ? blob.getBytes().length : 0,
getAppProperty: (key) => {
return (newFile as any)._properties?.[key]
}