Skip to content

Commit

Permalink
facebook-api: use the icon URL as a backup checksum
Browse files Browse the repository at this point in the history
There is a report of the 'oh' parameter missing from some of the icon
images, which is used as the checksum. The solution is to simply use
the URL itself as the checksum in the *rare* case the 'oh' parameter
is missing.
  • Loading branch information
jgeboski committed Jan 16, 2016
1 parent c4211e1 commit 8315971
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions facebook/facebook-api.c
Original file line number Diff line number Diff line change
Expand Up @@ -1936,9 +1936,14 @@ fb_api_cb_contact(FbHttpRequest *req, gpointer data)

prms = fb_http_values_new();
fb_http_values_parse(prms, user.icon, TRUE);
user.csum = fb_http_values_dup_str(prms, "oh", &err);
user.csum = fb_http_values_dup_str(prms, "oh", NULL);
fb_http_values_free(prms);

if (G_UNLIKELY(user.csum == NULL)) {
/* Revert to the icon URL as the unique checksum */
user.csum = g_strdup(user.icon);
}

g_signal_emit_by_name(api, "contact", &user);
fb_api_user_reset(&user, TRUE);
g_object_unref(values);
Expand Down Expand Up @@ -2016,8 +2021,14 @@ fb_api_cb_contacts(FbHttpRequest *req, gpointer data)

prms = fb_http_values_new();
fb_http_values_parse(prms, user->icon, TRUE);
user->csum = fb_http_values_dup_str(prms, "oh", &err);
user->csum = fb_http_values_dup_str(prms, "oh", NULL);
fb_http_values_free(prms);

if (G_UNLIKELY(user->csum == NULL)) {
/* Revert to the icon URL as the unique checksum */
user->csum = g_strdup(user->icon);
}

users = g_slist_prepend(users, user);
}

Expand Down

0 comments on commit 8315971

Please sign in to comment.