Check before building the current URL to see if a trailing slash should be appended or not, that way if a request includes one, the signature still matches.

This commit is contained in:
Justin Shreve 2015-06-19 16:05:23 +00:00
parent c43f9157c3
commit 59bc17e0cb
1 changed files with 8 additions and 1 deletions

View File

@ -225,7 +225,14 @@ class WC_API_Authentication {
$http_method = strtoupper( WC()->api->server->method );
$base_request_uri = rawurlencode( untrailingslashit( get_woocommerce_api_url( '' ) ) . WC()->api->server->path );
$server_path = WC()->api->server->path;
// if the requested URL has a trailingslash, make sure our base URL does as well
if ( wp_endswith( $_SERVER['REDIRECT_URL'], '/' ) ) {
$server_path .= '/';
}
$base_request_uri = rawurlencode( untrailingslashit( get_woocommerce_api_url( '' ) ) . $server_path );
// Get the signature provided by the consumer and remove it from the parameters prior to checking the signature
$consumer_signature = rawurldecode( $params['oauth_signature'] );