3ebbbdd9 by Adam Heath

If the fetch has been remapped, and there would be duplicated '/' when

joining the strings, then remove the extra slashes.
1 parent f424bfd7
......@@ -45,7 +45,13 @@ const baseQuery = fetchBaseQuery()
const siteBaseQuery = async (args, api, options) => {
const { site, url } = args
const fetchUrl = getSiteFetchUrl(site) || ''
return baseQuery({ ...args, url: `${fetchUrl}${url}` }, api, options)
let newUrl
if (fetchUrl.endsWith('/') && url.startsWith('/')) {
newUrl = fetchUrl + url.replace(/^\/+/, '')
} else {
newUrl = fetchUrl + url
}
return baseQuery({ ...args, url: newUrl }, api, options)
}
export const sitePageSlice = createApi({
......