1
0

Fix garbled/mojibake text display issues for non-English Unicode characters in browsers. (#441)

* Update util.go

Fix garbled/mojibake text display issues for non-English Unicode characters in browsers.

* add Content-Disposition, help handle file name on download

Author:    awkj <hzzbiu@gmail.com>
هذا الالتزام موجود في:
awkj
2025-03-17 23:22:54 +08:00
ملتزم من قبل GitHub
الأصل d53885c541
التزام da0b440360
2 ملفات معدلة مع 16 إضافات و4 حذوفات

عرض الملف

@@ -21,7 +21,9 @@ func RawFile(ctx *context.Context) error {
return ctx.NotFound("File not found")
}
contentType := handlers.GetContentTypeFromFilename(file.Filename)
ContentDisposition := handlers.GetContentDisposition(file.Filename)
ctx.Response().Header().Set("Content-Type", contentType)
ctx.Response().Header().Set("Content-Disposition", ContentDisposition)
return ctx.PlainText(200, file.Content)
}