From f623a3d6e22b648943e4d04affa4957241ca167f Mon Sep 17 00:00:00 2001 From: Ian P Bradley Date: Sun, 29 Sep 2024 19:08:17 -0700 Subject: [PATCH] Plack::MIME: Add definitions for JPEG XL, zstd and GnuPG file extensions These additions make sure Plack can serve these filetypes now nearly ubiquitous to the modern web without issue For instance this fixes large, non-armored PGP files that have the just as common .gpg extension, regardless of encryption status i.e. a file with an attached signature, and archives utiizing zstd compression mistakenly getting opened as text rather than binary in the browser which can interrupt normal usage both often and long enough to cause annoyance That, and JPEG XL images will open in-browser if supported --- lib/Plack/MIME.pm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/Plack/MIME.pm b/lib/Plack/MIME.pm index 0d39351c..23ef2cac 100644 --- a/lib/Plack/MIME.pm +++ b/lib/Plack/MIME.pm @@ -178,6 +178,7 @@ our $MIME_TYPES = { ".gif" => "image/gif", ".gim" => "application/vnd.groove-identity-message", ".gmx" => "application/vnd.gmx", + ".gpg" => "application/octet-stream", ".gph" => "application/vnd.flographit", ".gqf" => "application/vnd.grafeq", ".gram" => "application/srgs", @@ -246,6 +247,7 @@ our $MIME_TYPES = { ".jpm" => "video/jpm", ".js" => "text/javascript", ".json" => "application/json", + ".jxl" => "image/jxl", ".karbon" => "application/vnd.kde.karbon", ".kfo" => "application/vnd.kde.kformula", ".kia" => "application/vnd.kidspiration", @@ -527,6 +529,7 @@ our $MIME_TYPES = { ".t" => "text/troff", ".tao" => "application/vnd.tao.intent-module-archive", ".tar" => "application/x-tar", + ".tar.zst" => "application/x-zstd-compressed-tar", ".tbz" => "application/x-bzip-compressed-tar", ".tcap" => "application/vnd.3gpp2.tcap", ".tcl" => "application/x-tcl", @@ -550,6 +553,7 @@ our $MIME_TYPES = { ".txd" => "application/vnd.genomatix.tuxedo", ".txf" => "application/vnd.mobius.txf", ".txt" => "text/plain", + ".tzst" => "application/x-zstd-compressed-tar", ".ufd" => "application/vnd.ufdl", ".umj" => "application/vnd.umajin", ".unityweb" => "application/vnd.unity", @@ -643,6 +647,8 @@ our $MIME_TYPES = { ".zaz" => "application/vnd.zzazz.deck+xml", ".zip" => "application/zip", ".zmm" => "application/vnd.handheld-entertainment+xml", + ".zst" => "application/zstd", + ".zstd" => "application/zstd" }; my $fallback = sub { };