mirror of
https://github.com/hoppscotch/hoppscotch.git
synced 2026-04-25 16:55:59 +03:00
[PR #5306] [MERGED] fix(relay): expand MIME type support #5155
Labels
No labels
CodeDay
a11y
browser limited
bug
bug fix
cli
core
critical
design
desktop
discussion
docker
documentation
duplicate
enterprise
feature
feature
fosshack
future
good first issue
hacktoberfest
help wanted
i18n
invalid
major
minor
need information
need testing
not applicable to hoppscotch
not reproducible
pull-request
question
refactor
resolved
sandbox
self-host
spam
stale
testmu
wip
wont fix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/hoppscotch#5155
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/hoppscotch/hoppscotch/pull/5306
Author: @CuriousCorrelation
Created: 8/5/2025
Status: ✅ Merged
Merged: 8/8/2025
Merged by: @jamesgeorge007
Base:
patch← Head:desktop-feat-expand-relay-mime-type-support📝 Commits (1)
421061ffix(relay): expand MIME type support📊 Changes
8 files changed (+95 additions, -16 deletions)
View changed files
📝
packages/hoppscotch-agent/src-tauri/Cargo.lock(+1 -1)📝
packages/hoppscotch-common/src/components.d.ts(+1 -2)📝
packages/hoppscotch-desktop/plugin-workspace/relay/src/interop.rs(+83 -3)📝
packages/hoppscotch-desktop/plugin-workspace/tauri-plugin-relay/Cargo.lock(+1 -1)📝
packages/hoppscotch-desktop/src-tauri/Cargo.lock(+2 -2)📝
packages/hoppscotch-desktop/src-tauri/Cargo.toml(+1 -1)📝
packages/hoppscotch-kernel/package.json(+1 -1)📝
pnpm-lock.yaml(+5 -5)📄 Description
This fixes file uploads incorrectly showing MIME type as "Other" instead
of their actual content types by expanding the
MediaTypeenum relayto include common audio, video, and image formats.
Basically
MediaTypeenum is used for bothContentTypewhich wouldmap to
ContentTypefromhoppscotch-data(e.g.multipart/form-data)but also to
FormValueininteropalthough the later should be much more pervasive.
This is a follow up on #5244
Closes FE-887
Closes #3810
Closes #5223
Closes #5233
The issue occurred because the
relay'sMediaTypecouldn't deserializebeyond the basic types (text, JSON, XML, etc.), lacked support for
other media file types. The TypeScript layer correctly detected MIME
types (e.g., "audio/x-m4a"), but the deserialization process fell back
to
MediaType::Other. Main reason for servers performing strict MIMEvalidation to reject uploads.
What's changed
The
MediaTypeenum in/src/interop.rsnow includes:Audio types: AudioMpeg, AudioMp4, AudioXM4a, AudioWav, AudioOgg,
AudioAac, AudioFlac
Video types: VideoMp4, VideoAvi, VideoQuicktime, VideoXMsvideo,
VideoWebm, VideoXFlv
Image types: ImagePng, ImageJpeg, ImageGif, ImageSvgXml, ImageWebp,
ImageBmp, ImageXIcon
Some more application types: ApplicationPdf, ApplicationZip,
ApplicationJavascript
Each variant includes proper
serderenameattributes to match standardMIME type strings
(like
#[serde(rename = "audio/x-m4a")]for AudioXM4a).Testing
Use
httpbin.org/postwith this request setup:See:
https://github.com/hoppscotch/hoppscotch/pull/5228#issuecomment-3052343920
Previously:
Expected:
Using curl:
This change maintains backward compatibility since
MediaType::Otherremains as the go-to fallback for any unrecognized types.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.