From a4ff16b928ca1bcfc2eb0b7ba9363ff441a91882 Mon Sep 17 00:00:00 2001 From: Aaron Parecki Date: Sun, 25 Jun 2017 14:34:57 -0700 Subject: [PATCH] follow relative URLs in micropub Location response --- controllers/micropub.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/controllers/micropub.php b/controllers/micropub.php index 5bf8a5f..8a4440c 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' => $r['location'], + 'location' => (isset($r['location']) ? Mf2\resolveUrl($r['location'], $user->micropub_endpoint) : 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']) ? $r['location'] : null), + 'location' => (isset($r['location']) ? Mf2\resolveUrl($r['location'], $user->micropub_endpoint) : null), 'error' => (isset($r['error']) ? $r['error'] : null), ))); }