From 2479e4a45f8cd39b271136b8bc75982d92e46c35 Mon Sep 17 00:00:00 2001 From: HugoFara Date: Mon, 8 Jan 2024 13:19:15 +0100 Subject: [PATCH] Fixes REST API not working when LWT was running in root folder. --- api.php | 2 +- docs/CHANGELOG.md | 1 + docs/info.html | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/api.php b/api.php index 088e9c58..6d872d0a 100644 --- a/api.php +++ b/api.php @@ -97,7 +97,7 @@ function endpoint_exits($method, $requestUri) // Extract requested endpoint from URI $uri_query = parse_url($requestUri, PHP_URL_PATH); - $matching = preg_match('/(.+?\/api.php\/v\d\/).+/', $uri_query, $matches); + $matching = preg_match('/(.*?\/api\.php\/v\d\/).+/', $uri_query, $matches); if (!$matching) { send_response(400, ['error' => 'Unrecognized URL format ' . $uri_query]); } diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 1f04c186..97f0245d 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -103,6 +103,7 @@ Solves [#129](https://github.com/HugoFara/lwt/issues/129), thanks to the help of * An explicit dependency to [php-dom](https://www.php.net/manual/en/book.dom.php) was missing in `INSTALL.sh` (and `composer.json`), as stated in [#178](https://github.com/HugoFara/lwt/pull/178). +* API: the REST API was not accessible for users running LWT in a root folder. ### Deprecated diff --git a/docs/info.html b/docs/info.html index dbfd4baa..ac6c4def 100644 --- a/docs/info.html +++ b/docs/info.html @@ -2362,6 +2362,7 @@

Fixed

  • An explicit dependency to php-dom was missing in INSTALL.sh (and composer.json), as stated in #178.
  • +
  • API: the REST API was not accessible for users running LWT in a root folder.
  • Deprecated