From 6906509aea4d7948bb0cef95da8db02fb5d481fd Mon Sep 17 00:00:00 2001 From: Ilyas Hallak Date: Sun, 19 Oct 2025 19:40:25 +0200 Subject: [PATCH] fix: Remove trailing slash from endpoint instead of adding it Trailing slash is added elsewhere in the codebase, so here we remove it if present to avoid duplication --- readeck/UI/Settings/SettingsServerViewModel.swift | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/readeck/UI/Settings/SettingsServerViewModel.swift b/readeck/UI/Settings/SettingsServerViewModel.swift index 468757a..5ac59df 100644 --- a/readeck/UI/Settings/SettingsServerViewModel.swift +++ b/readeck/UI/Settings/SettingsServerViewModel.swift @@ -114,13 +114,9 @@ class SettingsServerViewModel { urlComponents.scheme = "https" } - // Add trailing slash to path if not present - if urlComponents.path.isEmpty || !urlComponents.path.hasSuffix("/") { - if urlComponents.path.isEmpty { - urlComponents.path = "/" - } else { - urlComponents.path += "/" - } + // Remove trailing slash from path if present + if urlComponents.path.hasSuffix("/") { + urlComponents.path = String(urlComponents.path.dropLast()) } // Remove query parameters (already done above, but double check)