fix: Make video file detection case-insensitive for MP4 extensions #1032
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #1033
Problem
Video files with uppercase extensions (e.g.,
.MP4) from AI video generation tools like OpenAI Sora are not being properly recognized as video files. Instead, they're being incorrectly processed by the Next.js Image component, resulting in 400 Bad Request errors in the Media Library.Screenshot showing the error:

Root Cause
The application only checks for lowercase
'mp4'in file extensions:This fails for files with
.MP4,.Mp4, or any other case variations.Solution
Made all MP4 file detection case-insensitive by converting paths to lowercase before checking:
Changes
Files Modified (24 total):
Frontend Components:
apps/frontend/src/components/media/media.component.tsx- Media Library and MediaBox componentsapps/frontend/src/components/launches/helpers/media.settings.component.tsx- Media settings editorapps/frontend/src/components/agents/agent.chat.tsx- Agent chat media detectionlibraries/react-shared-libraries/src/helpers/video.or.image.tsx- Shared video/image helperProvider Components (Frontend):
Backend Integrations:
libraries/nestjs-libraries/src/integrations/social/*.provider.ts- All social media platform integrations (X, Facebook, LinkedIn, Pinterest, Reddit, TikTok, VK, Bluesky)Testing
✅ Tested with uppercase
.MP4files from OpenAI Sora✅ Videos now correctly render using video players instead of Next.js Image
✅ No regressions for lowercase
.mp4files✅ All TypeScript compilation passes with 0 errors
✅ Dev server runs successfully on both local and Docker environments
Impact
.mp4,.MP4,.Mp4)Affected Areas
Related Issue: Fixes media library 400 errors when uploading videos with uppercase extensions