Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
matrix-media-repo
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
matrix-media-repo
Commits
77ec2354
Commit
77ec2354
authored
1 year ago
by
Travis Ralston
Browse files
Options
Downloads
Patches
Plain Diff
Fix Content-Disposition handling
parent
081a53ae
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
api/_routers/98-use-rcontext.go
+1
-1
1 addition, 1 deletion
api/_routers/98-use-rcontext.go
util/mime.go
+36
-0
36 additions, 0 deletions
util/mime.go
with
37 additions
and
1 deletion
api/_routers/98-use-rcontext.go
+
1
−
1
View file @
77ec2354
...
...
@@ -112,7 +112,7 @@ beforeParseDownload:
if
contentType
==
""
{
disposition
=
"attachment"
}
else
{
if
util
.
HasAnyPrefix
(
contentType
,
[]
string
{
"image/"
,
"audio/"
,
"video/"
,
"text/plain"
}
)
{
if
util
.
CanInline
(
contentType
)
{
disposition
=
"inline"
}
else
{
disposition
=
"attachment"
...
...
This diff is collapsed.
Click to expand it.
util/mime.go
+
36
−
0
View file @
77ec2354
...
...
@@ -16,3 +16,39 @@ func ExtensionForContentType(ct string) string {
}
return
".bin"
}
func
CanInline
(
ct
string
)
bool
{
ct
=
FixContentType
(
ct
)
return
ArrayContains
(
InlineContentTypes
,
ct
)
}
var
InlineContentTypes
=
[]
string
{
// Types are inherited from https://github.com/matrix-org/synapse/pull/15988
"text/css"
,
"text/plain"
,
"text/csv"
,
"application/json"
,
"application/ld+json"
,
"image/jpeg"
,
"image/gif"
,
"image/png"
,
"image/apng"
,
"image/webp"
,
"image/avif"
,
"video/mp4"
,
"video/webm"
,
"video/ogg"
,
"video/quicktime"
,
"audio/mp4"
,
"audio/webm"
,
"audio/aac"
,
"audio/mpeg"
,
"audio/ogg"
,
"audio/wave"
,
"audio/wav"
,
"audio/x-wav"
,
"audio/x-pn-wav"
,
"audio/flac"
,
"audio/x-flac"
,
}
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