Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
conduwuit
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
🥺
conduwuit
Commits
4185a337
Commit
4185a337
authored
10 months ago
by
🥺
Committed by
🥺
10 months ago
Browse files
Options
Downloads
Patches
Plain Diff
fix: we should be checking for `xml` MIME type instead
Signed-off-by:
strawberry
<
strawberry@puppygock.gay
>
parent
829307c8
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/utils/content_disposition.rs
+5
-1
5 additions, 1 deletion
src/utils/content_disposition.rs
with
5 additions
and
1 deletion
src/utils/content_disposition.rs
+
5
−
1
View file @
4185a337
use
infer
::
MatcherType
;
use
crate
::
debug_info
;
/// Returns a Content-Disposition of `attachment` or `inline`, depending on the
/// *parsed* contents of the file uploaded via format magic keys using `infer`
/// crate (basically libmagic without needing libmagic).
...
...
@@ -15,9 +17,11 @@ pub(crate) fn content_disposition_type(buf: &[u8], _content_type: &Option<String
return
"attachment"
;
};
debug_info!
(
"MIME type: {}"
,
file_type
.mime_type
());
match
file_type
.matcher_type
()
{
MatcherType
::
Image
|
MatcherType
::
Audio
|
MatcherType
::
Text
|
MatcherType
::
Video
=>
{
if
file_type
.mime_type
()
.contains
(
"
svg
"
)
{
if
file_type
.mime_type
()
.contains
(
"
xml
"
)
{
"attachment"
}
else
{
"inline"
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment