[epiphany] profile-migrator: Handle double bookmark timestamp migration
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany] profile-migrator: Handle double bookmark timestamp migration
- Date: Mon, 22 Jan 2018 18:50:02 +0000 (UTC)
commit 3e26616eb5d125e0b2ebd479aa9fcb2b64e01675
Author: Michael Catanzaro <mcatanzaro igalia com>
Date: Mon Jan 22 12:38:36 2018 -0600
profile-migrator: Handle double bookmark timestamp migration
It's common for developers to run the profile migrator several times in
a row. Migrators should be robust to this. We need to ensure the
GVariant format is really the old format before using it in the
timestamp migration.
https://bugzilla.gnome.org/show_bug.cgi?id=792683
src/profile-migrator/ephy-profile-migrator.c | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/src/profile-migrator/ephy-profile-migrator.c b/src/profile-migrator/ephy-profile-migrator.c
index ef0abe7..13f51c7 100644
--- a/src/profile-migrator/ephy-profile-migrator.c
+++ b/src/profile-migrator/ephy-profile-migrator.c
@@ -996,6 +996,9 @@ convert_bookmark_timestamp (GVariant *value)
const char *id;
char *tag;
+ if (!g_variant_check_format_string (value, "(x&s&sdbas)", FALSE))
+ return NULL;
+
g_variant_get (value, "(x&s&sdbas)",
&time_added, &title, &id,
×tamp_d, &is_uploaded, &iter);
@@ -1066,9 +1069,14 @@ migrate_bookmarks_timestamp (void)
for (int i = 0; i < length; i++) {
GVariant *value = gvdb_table_get_value (bookmarks_table_in, urls[i]);
GVariant *new_value = convert_bookmark_timestamp (value);
- GvdbItem *item = gvdb_hash_table_insert (bookmarks_table_out, urls[i]);
- gvdb_item_set_value (item, new_value);
+ if (new_value != NULL) {
+ GvdbItem *item = gvdb_hash_table_insert (bookmarks_table_out, urls[i]);
+ gvdb_item_set_value (item, new_value);
+ }
g_variant_unref (value);
+
+ if (new_value == NULL)
+ goto out;
}
gvdb_table_write_contents (root_table_out, filename, FALSE, NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]