mirror of
https://github.com/xorgy/mediafire-fuse
synced 2026-01-13 21:24:28 -08:00
check and return mediafire response code for every api call
This commit is contained in:
@@ -86,8 +86,21 @@ static int _decode_file_get_info(mfhttp * conn, void *data)
|
||||
|
||||
root = http_parse_buf_json(conn, 0, &error);
|
||||
|
||||
if (root == NULL) {
|
||||
fprintf(stderr, "http_parse_buf_json failed at line %d\n", error.line);
|
||||
fprintf(stderr, "error message: %s\n", error.text);
|
||||
return -1;
|
||||
}
|
||||
|
||||
node = json_object_by_path(root, "response/file_info");
|
||||
|
||||
retval = mfapi_check_response(node, "file/get_info");
|
||||
if (retval != 0) {
|
||||
fprintf(stderr, "invalid response\n");
|
||||
json_decref(root);
|
||||
return retval;
|
||||
}
|
||||
|
||||
quickkey = json_object_get(node, "quickkey");
|
||||
if (quickkey != NULL)
|
||||
file_set_key(file, json_string_value(quickkey));
|
||||
@@ -133,8 +146,7 @@ static int _decode_file_get_info(mfhttp * conn, void *data)
|
||||
if (quickkey == NULL)
|
||||
retval = -1;
|
||||
|
||||
if (root != NULL)
|
||||
json_decref(root);
|
||||
json_decref(root);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user