From fd2f542ccf00749ac19ad8aa54f58252cb2484c2 Mon Sep 17 00:00:00 2001 From: David Calhoun Date: Mon, 28 Jul 2025 11:27:32 -0400 Subject: [PATCH] fix: Remove redundant trailing slash from API namespace configuration Trailing slashes are now expected to be providing in the configuration. This expectation was put in place to simplify configuration logic here and in host apps. This change prevents double trailing slashes, which began occurring in WP-Android in the following. This resulted in failed API requests, like image uploads. https://github.com/wordpress-mobile/WordPress-Android/pull/22035 --- src/utils/api-fetch.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/api-fetch.js b/src/utils/api-fetch.js index f7ff4e25..aee13229 100644 --- a/src/utils/api-fetch.js +++ b/src/utils/api-fetch.js @@ -68,7 +68,7 @@ function apiPathModifierMiddleware( options, next ) { // Insert the API namespace after the first two path segments. options.path = options.path.replace( /^(?\/?(?:[\w.-]+\/){2})/, - `$${ siteApiNamespace[ 0 ] }/` + `$${ siteApiNamespace[ 0 ] }` ); }