Skip to content

Commit

Permalink
inline files
Browse files Browse the repository at this point in the history
so I can be previewed in a browser, nicer for pictures
  • Loading branch information
odrling committed Jul 16, 2024
1 parent 8b2d3c5 commit 9fd95ce
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions server/files.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,8 @@ func Download(ctx context.Context, input *DownloadInput) (*huma.StreamResponse,
filename := url.PathEscape(stat.UserMetadata["Filename"])
content_type := stat.UserMetadata["Type"]

main_type, _, _ := strings.Cut(content_type, "/")

ctx.SetHeader("Accept-Range", "bytes")
if main_type == "text" {
ctx.SetHeader("Content-Disposition", fmt.Sprintf("inline; filename=\"%s\"; filename*=UTF-8''%s", filename, filename))
} else {
ctx.SetHeader("Content-Disposition", fmt.Sprintf("attachment; filename=\"%s\"; filename*=UTF-8''%s", filename, filename))
}
ctx.SetHeader("Content-Disposition", fmt.Sprintf("inline; filename=\"%s\"; filename*=UTF-8''%s", filename, filename))
ctx.SetHeader("Content-Type", content_type)

var start int64
Expand Down

0 comments on commit 9fd95ce

Please sign in to comment.