fix: sanitize relay URLs by removing trailing slashes

This commit is contained in:
2025-04-21 00:04:52 +02:00
parent 0857d4a7ab
commit 5cc9218971
2 changed files with 11 additions and 1 deletions

View File

@@ -34,6 +34,11 @@ export function AddRelaySheet({ onRelayAdded }: AddRelaySheetProps) {
if (!formattedUrl.startsWith("wss://")) {
formattedUrl = `wss://${formattedUrl}`;
}
// Remove trailing slash if present
if (formattedUrl.endsWith('/')) {
formattedUrl = formattedUrl.slice(0, -1);
}
// Check if relay already exists in connected relays
const existingRelays = connectedRelays?.map(relay => relay.url) || [];