summaryrefslogtreecommitdiff
path: root/controllers
diff options
context:
space:
mode:
authorAaron Parecki <aaron@parecki.com>2017-06-26 15:34:27 -0700
committerAaron Parecki <aaron@parecki.com>2017-06-26 15:34:27 -0700
commit820ad1b8271dc7dbf1dba8eb37ab63b999159d09 (patch)
treef7a5ebbf6e3faf150bd923d05d7d5302b5149547 /controllers
parenta81770aaefdca11c2063df0edeeceb0e3a9a6c14 (diff)
fix returning resolved URL
Diffstat (limited to 'controllers')
-rw-r--r--controllers/micropub.php10
1 files changed, 5 insertions, 5 deletions
diff --git a/controllers/micropub.php b/controllers/micropub.php
index 70bfc44..871c9cf 100644
--- a/controllers/micropub.php
+++ b/controllers/micropub.php
@@ -26,7 +26,7 @@ $app->post('/micropub/post', function() use($app) {
$app->response()->body(json_encode(array(
'request' => htmlspecialchars($r['request']),
'response' => htmlspecialchars($r['response']),
- 'location' => (isset($r['location']) ? Mf2\resolveUrl($user->micropub_endpoint, $r['location']) : null),
+ 'location' => (isset($r['location']) && $r['location'] ? Mf2\resolveUrl($user->micropub_endpoint, $r['location']) : null),
'error' => $r['error'],
'curlinfo' => $r['curlinfo']
)));
@@ -69,7 +69,7 @@ $app->post('/micropub/multipart', function() use($app) {
$app->response()['Content-type'] = 'application/json';
$app->response()->body(json_encode(array(
'response' => (isset($r['response']) ? htmlspecialchars($r['response']) : null),
- 'location' => (isset($r['location']) ? Mf2\resolveUrl($user->micropub_endpoint, $r['location']) : null),
+ 'location' => (isset($r['location']) && $r['location'] ? Mf2\resolveUrl($user->micropub_endpoint, $r['location']) : null),
'error' => (isset($r['error']) ? $r['error'] : null),
)));
}
@@ -108,10 +108,10 @@ $app->post('/micropub/postjson', function() use($app) {
$r = micropub_post_for_user($user, json_decode($params['data'], true), null, true);
$app->response()['Content-type'] = 'application/json';
- $app->response()->body(json_encode(array(
- 'location' => $r['location'],
+ $app->response()->body(json_encode([
+ 'location' => (isset($r['location']) && $r['location'] ? Mf2\resolveUrl($user->micropub_endpoint, $r['location']) : null),
'error' => $r['error'],
'response' => $r['response']
- )));
+ ]));
}
});