[evince] comics: Return an error when archive contents are encrypted
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evince] comics: Return an error when archive contents are encrypted
- Date: Sat, 22 Jul 2017 13:03:54 +0000 (UTC)
commit 29747f1e9a915973813886378dfe920ebee38a1b
Author: Bastien Nocera <hadess hadess net>
Date: Tue Jul 18 12:06:09 2017 +0200
comics: Return an error when archive contents are encrypted
Note that this will request a password and crash when it cannot pass that
information to the EvDocument later. This needs to be fixed in the
evince shell itself.
https://bugzilla.gnome.org/show_bug.cgi?id=784963
backend/comics/comics-document.c | 22 ++++++++++++++++++----
1 files changed, 18 insertions(+), 4 deletions(-)
---
diff --git a/backend/comics/comics-document.c b/backend/comics/comics-document.c
index 611d752..4ead1dd 100644
--- a/backend/comics/comics-document.c
+++ b/backend/comics/comics-document.c
@@ -64,6 +64,7 @@ comics_document_list (ComicsDocument *comics_document,
{
char **ret = NULL;
GPtrArray *array;
+ gboolean has_encrypted_files;
if (!ev_archive_open_filename (comics_document->archive, comics_document->archive_path, error)) {
if (*error != NULL) {
@@ -78,6 +79,7 @@ comics_document_list (ComicsDocument *comics_document,
goto out;
}
+ has_encrypted_files = FALSE;
array = g_ptr_array_new ();
while (1) {
@@ -100,6 +102,11 @@ comics_document_list (ComicsDocument *comics_document,
}
name = ev_archive_get_entry_pathname (comics_document->archive);
+ if (ev_archive_get_entry_is_encrypted (comics_document->archive)) {
+ g_debug ("Not adding encrypted file '%s' to the list of files in the comics", name);
+ has_encrypted_files = TRUE;
+ continue;
+ }
g_debug ("Adding '%s' to the list of files in the comics", name);
g_ptr_array_add (array, g_strdup (name));
@@ -107,10 +114,17 @@ comics_document_list (ComicsDocument *comics_document,
if (array->len == 0) {
g_ptr_array_free (array, TRUE);
- g_set_error_literal (error,
- EV_DOCUMENT_ERROR,
- EV_DOCUMENT_ERROR_INVALID,
- _("No files in archive"));
+ if (has_encrypted_files) {
+ g_set_error_literal (error,
+ EV_DOCUMENT_ERROR,
+ EV_DOCUMENT_ERROR_ENCRYPTED,
+ _("Archive is encrypted"));
+ } else {
+ g_set_error_literal (error,
+ EV_DOCUMENT_ERROR,
+ EV_DOCUMENT_ERROR_INVALID,
+ _("No files in archive"));
+ }
} else {
g_ptr_array_add (array, NULL);
ret = (char **) g_ptr_array_free (array, FALSE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]