From c1b2243adbdc1b4854190bd8903e9513fb9f2f21 Mon Sep 17 00:00:00 2001 From: QuietlyChan Date: Fri, 8 Nov 2024 17:17:34 +0800 Subject: [PATCH] feat: Add support for complete domain names in the new URL prefix. (#8893) Co-authored-by: crazywoola <427733928@qq.com> --- web/service/base.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/web/service/base.ts b/web/service/base.ts index fcf8d8bd7d..6cb732c55d 100644 --- a/web/service/base.ts +++ b/web/service/base.ts @@ -321,7 +321,9 @@ const baseFetch = ( } const urlPrefix = isPublicAPI ? PUBLIC_API_PREFIX : API_PREFIX - let urlWithPrefix = `${urlPrefix}${url.startsWith('/') ? url : `/${url}`}` + let urlWithPrefix = (url.startsWith('http://') || url.startsWith('https://')) + ? url + : `${urlPrefix}${url.startsWith('/') ? url : `/${url}`}` const { method, params, body } = options // handle query @@ -494,7 +496,9 @@ export const ssePost = ( getAbortController?.(abortController) const urlPrefix = isPublicAPI ? PUBLIC_API_PREFIX : API_PREFIX - const urlWithPrefix = `${urlPrefix}${url.startsWith('/') ? url : `/${url}`}` + const urlWithPrefix = (url.startsWith('http://') || url.startsWith('https://')) + ? url + : `${urlPrefix}${url.startsWith('/') ? url : `/${url}`}` const { body } = options if (body)