Skip to content

Commit

Permalink
Fix Documents API regex to allow documents with dashes in name to be …
Browse files Browse the repository at this point in the history
…viewed
  • Loading branch information
jessepearson committed Jul 11, 2024
1 parent 503afc3 commit ac4eb0f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions changelog/fix-documents-api-regex
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fix

Fix Documents API regex to allow documents with dashes in name to be viewed.
2 changes: 1 addition & 1 deletion includes/wc-payment-api/class-wc-payments-api-client.php
Original file line number Diff line number Diff line change
Expand Up @@ -1795,7 +1795,7 @@ public function get_documents_summary( array $filters = [] ) {
* @throws API_Exception - If not connected or request failed.
*/
public function get_document( $document_id ) {
if ( ! preg_match( '/^\w+$/', $document_id ) ) {
if ( ! preg_match( '/^[\w-]+$/', $document_id ) ) {
throw new API_Exception(
__( 'Route param validation failed.', 'woocommerce-payments' ),
'wcpay_route_validation_failure',
Expand Down

0 comments on commit ac4eb0f

Please sign in to comment.