From ece2235890c687366aa635ccdaaaf5f838513ecb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A9=AC=E7=99=BB=E5=B1=B1?= Date: Mon, 9 Feb 2026 16:37:14 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=EF=BC=9A=20replication=20endpoint=20remo?= =?UTF-8?q?ve=20prefix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/replication/new-form.tsx | 36 +++++++++++------------------ 1 file changed, 13 insertions(+), 23 deletions(-) diff --git a/components/replication/new-form.tsx b/components/replication/new-form.tsx index 32524ab..ddb5209 100644 --- a/components/replication/new-form.tsx +++ b/components/replication/new-form.tsx @@ -32,7 +32,7 @@ export function ReplicationNewForm({ open, onOpenChange, bucketName, onSuccess } const { setRemoteReplicationTarget, putBucketReplication, getBucketReplication } = useBucket() const [level, setLevel] = useState("1") - const [endpoint, setEndpoint] = useState("http://") + const [endpoint, setEndpoint] = useState("") const [tls, setTls] = useState(false) const [accessKey, setAccessKey] = useState("") const [secretKey, setSecretKey] = useState("") @@ -66,25 +66,9 @@ export function ReplicationNewForm({ open, onOpenChange, bucketName, onSuccess } [], ) - useEffect(() => { - if (tls) { - if (endpoint.startsWith("http://")) { - setEndpoint(endpoint.replace("http://", "https://")) - } else if (!endpoint.startsWith("https://")) { - setEndpoint("https://" + endpoint) - } - } else { - if (endpoint.startsWith("https://")) { - setEndpoint(endpoint.replace("https://", "http://")) - } else if (!endpoint.startsWith("http://")) { - setEndpoint("http://" + endpoint) - } - } - }, [tls, endpoint]) - const resetForm = useCallback(() => { setLevel("1") - setEndpoint("http://") + setEndpoint("") setTls(false) setAccessKey("") setSecretKey("") @@ -309,11 +293,17 @@ export function ReplicationNewForm({ open, onOpenChange, bucketName, onSuccess } {t("Endpoint")} - setEndpoint(e.target.value)} - placeholder={t("Please enter endpoint")} - /> +
+
+ {tls ? "https://" : "http://"} +
+ setEndpoint(e.target.value)} + placeholder={t("Please enter endpoint")} + /> +