diff options
| author | Andrew Dolgov <fox@fakecake.org> | 2024-09-14 10:53:40 +0300 |
|---|---|---|
| committer | Andrew Dolgov <fox@fakecake.org> | 2024-09-14 10:53:40 +0300 |
| commit | 78c903cb7f10ae2e3f1f7ed6af65d99a229d4e03 (patch) | |
| tree | 7269f05ab5361d5e71a4967c6f75348f1713ec18 /classes | |
| parent | 3619ee97c546cbc8dcb300c594b2d59e40043397 (diff) | |
fix Config::get_self_url() invoked from plugin context, better deal with multiple trailing slashes in URL, update phpunit image path
Diffstat (limited to 'classes')
| -rw-r--r-- | classes/Config.php | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/classes/Config.php b/classes/Config.php index a1886e877..be9dd04e8 100644 --- a/classes/Config.php +++ b/classes/Config.php @@ -490,13 +490,9 @@ class Config { $proto = self::is_server_https() ? 'https' : 'http'; $self_url_path = $proto . '://' . $_SERVER["HTTP_HOST"] . parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH); - $self_url_path = preg_replace("/(\/api\/{1,})?(\w+\.php)?(\?.*$)?$/", "", $self_url_path); + $self_url_path = preg_replace("/(\/api\/{1,}|\/plugins(.local)?\/.{1,}\/{1,})?(\w+\.php)?(\?.*$)?$/", "", $self_url_path); - if (substr($self_url_path, -1) === "/") { - return substr($self_url_path, 0, -1); - } else { - return $self_url_path; - } + return rtrim($self_url_path, "/"); } } /* sanity check stuff */ |