You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How it will proceed with arbitrary encoded text files or binary files (for example, images and fonts) - the file contents will be corrupted in response. This applies when using .MapCompressionModule(...) and respectively ResponseMode.File.
The text was updated successfully, but these errors were encountered:
Good question, I've not had issues with it but then again I'm skipping most of the binary files with file extension types because binary images and binary fonts etc. are already compressed / doesn't benefit of zip so much.
And I guess the potential issue applies only cases where the file is directly read from disk, not cases where this is used in pipeline with selfhost or other file server?
Is this actual issue, and if it is, do you have any ideas for improvement?
And I guess the potential issue applies only cases where the file is directly read from disk
Yes, it applies to the .MapCompressionModule() -> getFile() call chain. I can agree that compressed binary files are not intended for additional compression, but DefaultCompressionSettings.AllowedExtensionAndMimeTypes for example, contains .ttf and .eot extensions which are binary files, if I remember correctly.
It can be improved by reading file in binary mode as byte array at once, like FileStream.ReadAsync (taking into account some performance issues).
Reading file contents in
getFile()
function ofOwinCompression
module implemented asStreamReader.ReadToEndAsync()
+System.Text.Encoding.UTF8.GetBytes
:https://github.com/Thorium/Owin.Compression/blob/master/src/Owin.Compression/CompressionModule.fs#L156
How it will proceed with arbitrary encoded text files or binary files (for example, images and fonts) - the file contents will be corrupted in response. This applies when using
.MapCompressionModule(...)
and respectivelyResponseMode.File
.The text was updated successfully, but these errors were encountered: