From 14b505130b36f97e7c422408acf6e52ccc94a306 Mon Sep 17 00:00:00 2001 From: 21pages Date: Mon, 22 Jul 2024 17:11:32 +0800 Subject: [PATCH] remove end slash when setting server config (#8779) Signed-off-by: 21pages --- flutter/lib/common.dart | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/flutter/lib/common.dart b/flutter/lib/common.dart index 2a5ed86fc..e58c361f8 100644 --- a/flutter/lib/common.dart +++ b/flutter/lib/common.dart @@ -3098,9 +3098,16 @@ Future setServerConfig( List? errMsgs, ServerConfig config, ) async { - config.idServer = config.idServer.trim(); - config.relayServer = config.relayServer.trim(); - config.apiServer = config.apiServer.trim(); + String removeEndSlash(String input) { + if (input.endsWith('/')) { + return input.substring(0, input.length - 1); + } + return input; + } + + config.idServer = removeEndSlash(config.idServer.trim()); + config.relayServer = removeEndSlash(config.relayServer.trim()); + config.apiServer = removeEndSlash(config.apiServer.trim()); config.key = config.key.trim(); if (controllers != null) { controllers[0].text = config.idServer;