Skip to content

Commit fd2f542

Browse files
committed
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. wordpress-mobile/WordPress-Android#22035
1 parent 80cab17 commit fd2f542

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/utils/api-fetch.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ function apiPathModifierMiddleware( options, next ) {
6868
// Insert the API namespace after the first two path segments.
6969
options.path = options.path.replace(
7070
/^(?<apiPath>\/?(?:[\w.-]+\/){2})/,
71-
`$<apiPath>${ siteApiNamespace[ 0 ] }/`
71+
`$<apiPath>${ siteApiNamespace[ 0 ] }`
7272
);
7373
}
7474

0 commit comments

Comments
 (0)