Merge pull request #3432 from annando/1705-api

Twidere reported error 501 when accessing a profile
This commit is contained in:
Hypolite Petovan 2017-05-05 17:57:30 -04:00 committed by GitHub
commit 3f4502155d
2 changed files with 15 additions and 0 deletions

View file

@ -172,6 +172,11 @@ On error:
HTTP 400 BadRequest HTTP 400 BadRequest
* on friendica_verbose=true: different JSON returns {"result":"error","message":"xyz"} * on friendica_verbose=true: different JSON returns {"result":"error","message":"xyz"}
---
### externalprofile/show (*)
#### Parameters
* profileurl: profile url
--- ---
### favorites (*; AUTH) ### favorites (*; AUTH)
#### Parameters #### Parameters

View file

@ -525,6 +525,15 @@ $called_api = null;
} }
} }
if (is_null($user) && x($_GET, 'profileurl')) {
$user = dbesc(normalise_link($_GET['profileurl']));
$nick = $user;
$extra_query = "AND `contact`.`nurl` = '%s' ";
if (api_user() !== false) {
$extra_query .= "AND `contact`.`uid`=".intval(api_user());
}
}
if (is_null($user) AND ($a->argc > (count($called_api) - 1)) AND (count($called_api) > 0)) { if (is_null($user) AND ($a->argc > (count($called_api) - 1)) AND (count($called_api) > 0)) {
$argid = count($called_api); $argid = count($called_api);
list($user, $null) = explode(".", $a->argv[$argid]); list($user, $null) = explode(".", $a->argv[$argid]);
@ -1400,6 +1409,7 @@ $called_api = null;
/// @TODO move to top of file or somewhere better /// @TODO move to top of file or somewhere better
api_register_func('api/users/show','api_users_show'); api_register_func('api/users/show','api_users_show');
api_register_func('api/externalprofile/show','api_users_show');
function api_users_search($type) { function api_users_search($type) {