[evince/wip/chpe/load-fd: 15/15] previewer: Try sniffing MIME type from FD
- From: Germán Poo-Caamaño <gpoo src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evince/wip/chpe/load-fd: 15/15] previewer: Try sniffing MIME type from FD
- Date: Wed, 12 Jan 2022 12:44:24 +0000 (UTC)
commit 33b87d06f4f601a047559bbc74b0196feb4c7e16
Author: Christian Persch <chpe src gnome org>
Date: Tue Jan 11 20:42:24 2022 +0100
previewer: Try sniffing MIME type from FD
When passing a file descriptor, but no MIME type was specified, try
sniffing the type from data.
previewer/ev-previewer.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/previewer/ev-previewer.c b/previewer/ev-previewer.c
index 4ccfbc20a..4754adc5b 100644
--- a/previewer/ev-previewer.c
+++ b/previewer/ev-previewer.c
@@ -2,7 +2,7 @@
* this file is part of evince, a gnome document viewer
*
* Copyright (C) 2009 Carlos Garcia Campos <carlosgc gnome org>
- * Copyright © 2012, 2018 Christian Persch
+ * Copyright © 2012, 2018, 2021, 2022 Christian Persch
*
* Evince is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
@@ -200,9 +200,11 @@ check_arguments (int argc,
return FALSE;
}
if (input_mime_type == NULL) {
- g_set_error_literal (error, G_OPTION_ERROR, G_OPTION_ERROR_BAD_VALUE,
- "Must specify --mime-type");
- return FALSE;
+ input_mime_type = ev_file_get_mime_type_from_fd (input_fd, error);
+ if (input_mime_type == NULL) {
+ g_prefix_error (error, "Must specify --mime-type: ");
+ return FALSE;
+ }
}
if (unlink_temp_file) {
g_set_error_literal (error, G_OPTION_ERROR, G_OPTION_ERROR_BAD_VALUE,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]