mirror of
https://github.com/kataras/iris.git
synced 2025-03-14 08:16:28 +01:00
fix #1580
This commit is contained in:
parent
ff5e43f341
commit
6fee09f11e
|
@ -293,6 +293,12 @@ func FileServer(fs http.FileSystem, options DirOptions) context.Handler {
|
||||||
// if it's cached and its settings didnt allow this file to be compressed
|
// if it's cached and its settings didnt allow this file to be compressed
|
||||||
// then don't try to compress it on the fly, even if the options.Compress was set to true.
|
// then don't try to compress it on the fly, even if the options.Compress was set to true.
|
||||||
if encoding != "" {
|
if encoding != "" {
|
||||||
|
if ctx.ResponseWriter().Header().Get(context.ContentEncodingHeaderKey) != "" {
|
||||||
|
// disable any compression writer if that header exist,
|
||||||
|
// note that, we don't directly check for CompressResponseWriter type
|
||||||
|
// because it may be a ResponseRecorder.
|
||||||
|
ctx.CompressWriter(false)
|
||||||
|
}
|
||||||
// Set the response header we need, the data are already compressed.
|
// Set the response header we need, the data are already compressed.
|
||||||
context.AddCompressHeaders(ctx.ResponseWriter().Header(), encoding)
|
context.AddCompressHeaders(ctx.ResponseWriter().Header(), encoding)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user