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() ...@@ -45,7 +45,13 @@ const baseQuery = fetchBaseQuery()
45 const siteBaseQuery = async (args, api, options) => { 45 const siteBaseQuery = async (args, api, options) => {
46 const { site, url } = args 46 const { site, url } = args
47 const fetchUrl = getSiteFetchUrl(site) || '' 47 const fetchUrl = getSiteFetchUrl(site) || ''
48 return baseQuery({ ...args, url: `${fetchUrl}${url}` }, api, options) 48 let newUrl
49 if (fetchUrl.endsWith('/') && url.startsWith('/')) {
50 newUrl = fetchUrl + url.replace(/^\/+/, '')
51 } else {
52 newUrl = fetchUrl + url
53 }
54 return baseQuery({ ...args, url: newUrl }, api, options)
49 } 55 }
50 56
51 export const sitePageSlice = createApi({ 57 export const sitePageSlice = createApi({
......