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
This commit is contained in:
Ilyas Hallak 2025-10-19 19:40:25 +02:00
parent afe3d1e261
commit 6906509aea

View File

@ -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)