ring-gzip icon indicating copy to clipboard operation
ring-gzip copied to clipboard

Extending supported types whitelist

Open phunanon opened this issue 5 years ago • 5 comments

There are many other extensions which could be added to supported-type?, for example .svg and .txt.
Could arbitrary types be added as settings somewhere? Or at least a more extensive list of uncompressed data types used on the web included.

Thanks!

phunanon avatar Jun 30 '19 22:06 phunanon

Is there any reason to keep the supported-type? check at all? Was this added to avoid re-gzipping .gz files or something like that?

It seems like any response content can be gzipped if requested, so why filter on the file extension?

joelittlejohn avatar Jul 01 '19 11:07 joelittlejohn

Is there any reason to keep the supported-type? check at all? Was this added to avoid re-gzipping .gz files or something like that?

It seems like any response content can be gzipped if requested, so why filter on the file extension?

There is no reason to try and zip already compressed items like png, jpeg, zip, 7z, gz...etc. It is even likely to be slower because the CPU time to compress them results in files exactly the same size or larger.

I also would like to see an option to pass a string to extend the supported types whitelist.

sirmspencer avatar Apr 13 '20 18:04 sirmspencer

There are many other extensions which could be added to supported-type?, for example .svg and .txt. Could arbitrary types be added as settings somewhere? Or at least a more extensive list of uncompressed data types used on the web included.

Thanks!

Its clearly a simple change to add extensions the the white list. Do you have a more extensive white list that you can propose?

sirmspencer avatar Apr 13 '20 18:04 sirmspencer

@sirmspencer, not necessarily, and I don't believe it should be something this repo tries to maintain. Perhaps it could also determine from MIME type.

phunanon avatar Apr 14 '20 09:04 phunanon

Maybe a blacklist instead? e.g. compressed-type?

joelittlejohn avatar Apr 14 '20 10:04 joelittlejohn