Skip to content

Commit 4a94eae

Browse files
authored
add path to route (#438)
* add path to route fix #421 * added changelog entry
1 parent 0763316 commit 4a94eae

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,10 @@ Project maintained on GitHub at [automattic/wordpress-activitypub](https://githu
107107

108108
### Next ###
109109

110-
* Compatibility: allow deactivating blocks registered by the plugin.
111-
* Compatibility: avoid Fatal Errors when using ClassicPress.
112-
* Fixed: fix a typo in a hook name.
110+
* Compatibility: allow deactivating blocks registered by the plugin
111+
* Compatibility: avoid Fatal Errors when using ClassicPress
112+
* Fixed: fix a typo in a hook name
113+
* Fixed: a problem with signatures when running WordPress in a sub-path
113114

114115
### 1.0.0 ###
115116

includes/class-signature.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,15 @@ public static function verify_http_signature( $request ) {
238238
} else {
239239
$route = '/' . rest_get_url_prefix() . '/' . ltrim( $request->get_route(), '/' );
240240
}
241+
242+
// fix route for subdirectory installs
243+
$path = wp_parse_url( get_home_url(), PHP_URL_PATH );
244+
$path = trim( $path, '/' );
245+
246+
if ( $path ) {
247+
$route = '/' . $path . $route;
248+
}
249+
241250
$headers = $request->get_headers();
242251
$headers['(request-target)'][0] = strtolower( $request->get_method() ) . ' ' . $route;
243252
} else {

readme.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,10 @@ Project maintained on GitHub at [automattic/wordpress-activitypub](https://githu
107107

108108
= Next =
109109

110-
* Compatibility: allow deactivating blocks registered by the plugin.
111-
* Compatibility: avoid Fatal Errors when using ClassicPress.
112-
* Fixed: fix a typo in a hook name.
110+
* Compatibility: allow deactivating blocks registered by the plugin
111+
* Compatibility: avoid Fatal Errors when using ClassicPress
112+
* Fixed: fix a typo in a hook name
113+
* Fixed: a problem with signatures when running WordPress in a sub-path
113114

114115
= 1.0.0 =
115116

0 commit comments

Comments
 (0)