fix(Google Gemini Node): Determine the file extention from MIME type for image and video operations#28616
Merged
RomanDavydchuk merged 3 commits intomasterfrom Apr 20, 2026
Merged
fix(Google Gemini Node): Determine the file extention from MIME type for image and video operations#28616RomanDavydchuk merged 3 commits intomasterfrom
RomanDavydchuk merged 3 commits intomasterfrom
Conversation
Contributor
Performance ComparisonComparing current → latest master → 14-day baseline Idle baseline with Instance AI module loaded
docker-stats
Memory consumption baseline with starter plan resources
How to read this table
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Contributor
There was a problem hiding this comment.
No issues found across 8 files
Architecture diagram
sequenceDiagram
participant E as n8n Execution Engine
participant G as Google Gemini Node
participant U as Helper Utils
participant API as Google Gemini API
participant EXT as External Storage (URL)
Note over E, EXT: Image/Video Generation & Processing Flow
E->>G: execute()
alt Image Generation / Editing
G->>API: POST /v1beta/models/...:generateContent
API-->>G: Returns base64 data + mimeType
else Video Generation (Asynchronous)
G->>API: POST /v1beta/models/...:generateVideo
API-->>G: Returns Operation URI
loop Poll Status
G->>API: GET Operation Status
API-->>G: done: true + video uri
end
G->>EXT: Download video from URI
EXT-->>G: Returns Buffer + mimeType
else Video Download (Direct)
G->>EXT: Download video from provided URL
EXT-->>G: Returns Buffer + mimeType
end
Note over G, U: NEW: Extension Resolution Logic
G->>U: NEW: getFilenameFromMimeType(mimeType, baseName, fallback)
U->>U: Lookup extension using 'mime-types' library
alt MIME type recognized
U-->>G: Returns e.g., "image.jpg" or "video.webm"
else MIME type unknown/missing
U-->>G: Returns fallback (e.g., "image.png" or "video.mp4")
end
G->>G: CHANGED: prepareBinaryData(buffer, fileName, mimeType)
Note right of G: Previously hardcoded to .png or .mp4
G-->>E: Return NodeExecutionData (Binary + JSON)
dlavrenuek
approved these changes
Apr 20, 2026
Contributor
|
Got released with |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Google Gemini node currently always uses
pngas the file extension for images that are generated/edited andmp4for generated videos. This causes issues when the actual image/video is notpngormp4. This PR fixes that by determining the file extension based on the file's MIME typeRelated Linear tickets, Github issues, and Community forum posts
https://linear.app/n8n/issue/NODE-4708/community-issue-google-gemini-node-mismatch-between-mimetype-imagejpeg
Closes #27382
Review / Merge checklist
Backport to Beta,Backport to Stable, orBackport to v1(if the PR is an urgent fix that needs to be backported)