summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/fr-archive.c1
-rw-r--r--src/fr-command-cfile.c22
-rw-r--r--src/fr-init.c2
3 files changed, 25 insertions, 0 deletions
diff --git a/src/fr-archive.c b/src/fr-archive.c
index fcb4c82..8745498 100644
--- a/src/fr-archive.c
+++ b/src/fr-archive.c
@@ -552,6 +552,7 @@ get_mime_type_from_magic_numbers (GFile *file)
{ 0, 6, "7z\274\257\047\034", "application/x-7z-compressed" },
{ 7, 7, "**ACE**", "application/x-ace" },
{ 0, 2, "\x60\xea", "application/x-arj" },
+ { 0, 4, "\xce\xb2\xcf\x81", "application/x-brotli" },
{ 0, 3, "BZh", "application/x-bzip2" },
{ 0, 2, "\037\213", "application/x-gzip" },
{ 0, 4, "LZIP", "application/x-lzip" },
diff --git a/src/fr-command-cfile.c b/src/fr-command-cfile.c
index 463e156..0500df7 100644
--- a/src/fr-command-cfile.c
+++ b/src/fr-command-cfile.c
@@ -233,6 +233,14 @@ fr_command_cfile_add (FrCommand *comm,
fr_process_end_command (comm->process);
compressed_filename = g_strconcat (filename, ".gz", NULL);
}
+ else if (is_mime_type (comm->mime_type, "application/x-brotli")) {
+ fr_process_begin_command (comm->process, "brotli");
+ fr_process_set_working_dir (comm->process, temp_dir);
+ fr_process_add_arg (comm->process, "--");
+ fr_process_add_arg (comm->process, filename);
+ fr_process_end_command (comm->process);
+ compressed_filename = g_strconcat (filename, ".br", NULL);
+ }
else if (is_mime_type (comm->mime_type, "application/x-bzip")) {
fr_process_begin_command (comm->process, "bzip2");
fr_process_set_working_dir (comm->process, temp_dir);
@@ -364,6 +372,13 @@ fr_command_cfile_extract (FrCommand *comm,
fr_process_add_arg (comm->process, temp_file);
fr_process_end_command (comm->process);
}
+ else if (is_mime_type (comm->mime_type, "application/x-brotli")) {
+ fr_process_begin_command (comm->process, "brotli");
+ fr_process_add_arg (comm->process, "-f");
+ fr_process_add_arg (comm->process, "-d");
+ fr_process_add_arg (comm->process, temp_file);
+ fr_process_end_command (comm->process);
+ }
else if (is_mime_type (comm->mime_type, "application/x-bzip")) {
fr_process_begin_command (comm->process, "bzip2");
fr_process_add_arg (comm->process, "-f");
@@ -456,6 +471,7 @@ fr_command_cfile_extract (FrCommand *comm,
const char *cfile_mime_type[] = { "application/x-gzip",
+ "application/x-brotli",
"application/x-bzip",
"application/x-compress",
"application/x-lzip",
@@ -485,6 +501,10 @@ fr_command_cfile_get_capabilities (FrCommand *comm,
if (is_program_available ("gzip", check_command))
capabilities |= FR_COMMAND_CAN_READ_WRITE;
}
+ else if (is_mime_type (mime_type, "application/x-brotli")) {
+ if (is_program_available ("brotli", check_command))
+ capabilities |= FR_COMMAND_CAN_READ_WRITE;
+ }
else if (is_mime_type (mime_type, "application/x-bzip")) {
if (is_program_available ("bzip2", check_command))
capabilities |= FR_COMMAND_CAN_READ_WRITE;
@@ -538,6 +558,8 @@ fr_command_cfile_get_packages (FrCommand *comm,
{
if (is_mime_type (mime_type, "application/x-gzip"))
return PACKAGES ("gzip");
+ else if (is_mime_type (mime_type, "application/x-brotli"))
+ return PACKAGES ("brotli");
else if (is_mime_type (mime_type, "application/x-bzip"))
return PACKAGES ("bzip2");
else if (is_mime_type (mime_type, "application/x-compress"))
diff --git a/src/fr-init.c b/src/fr-init.c
index 751cdcd..2927458 100644
--- a/src/fr-init.c
+++ b/src/fr-init.c
@@ -65,6 +65,7 @@ FrMimeTypeDescription mime_type_desc[] = {
{ "application/x-ar", ".a", N_("Ar (.a)"), 0 },
{ "application/x-ar", ".ar", N_("Ar (.ar)"), 0 },
{ "application/x-arj", ".arj", N_("Arj (.arj)"), 0 },
+ { "application/x-brotli", ".br", N_("brotli (.br)"), 0 },
{ "application/x-bzip", ".bz2", NULL, 0 },
{ "application/x-bzip-compressed-tar", ".tar.bz2", N_("Tar compressed with bzip2 (.tar.bz2)"), 0 },
{ "application/x-bzip1", ".bz", NULL, 0 },
@@ -119,6 +120,7 @@ FrExtensionType file_ext_type[] = {
{ ".ar", "application/x-ar" },
{ ".arj", "application/x-arj" },
{ ".bin", "application/x-stuffit" },
+ { ".br", "application/x-brotli" },
{ ".bz", "application/x-bzip" },
{ ".bz2", "application/x-bzip" },
{ ".cab", "application/vnd.ms-cab-compressed" },