Skip to content

Commit

Permalink
Extract target url from fbrpc:// URLs
Browse files Browse the repository at this point in the history
Those URLs seem to be generated when the Android share feature is used.

Fixes #97
  • Loading branch information
mickael9 authored and dequis committed Feb 24, 2017
1 parent bc8e710 commit 3e8dd70
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
6 changes: 5 additions & 1 deletion facebook/facebook-api.c
Original file line number Diff line number Diff line change
Expand Up @@ -1353,7 +1353,11 @@ fb_api_xma_parse(FbApi *api, const gchar *body, JsonNode *root, GError **error)
if (g_strcmp0(str, "ExternalUrl") == 0) {
prms = fb_http_values_new();
fb_http_values_parse(prms, url, TRUE);
text = fb_http_values_dup_str(prms, "u", NULL);
if (g_str_has_prefix(url, FB_API_FBRPC_PREFIX)) {
text = fb_http_values_dup_str(prms, "target_url", NULL);
} else {
text = fb_http_values_dup_str(prms, "u", NULL);
}
fb_http_values_free(prms);
} else {
text = g_strdup(url);
Expand Down
7 changes: 7 additions & 0 deletions facebook/facebook-api.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@
*/
#define FB_API_WHOST "https://www.facebook.com"

/**
* FB_API_FBRPC_PREFIX
*
* The fbrpc URL prefix used in links shared from the mobile app.
*/
#define FB_API_FBRPC_PREFIX "fbrpc://facebook/nativethirdparty"

/**
* FB_API_KEY:
*
Expand Down

0 comments on commit 3e8dd70

Please sign in to comment.