From 8ee58b48cfefca9e5b2e829c9bd215823aea4bfc Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Sun, 27 Oct 2024 11:57:54 -0700 Subject: [PATCH] Send apiURLString when checking for duplicate accounts. --- .../Accounts/AccountsReaderAPIWindowController.swift | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Mac/Preferences/Accounts/AccountsReaderAPIWindowController.swift b/Mac/Preferences/Accounts/AccountsReaderAPIWindowController.swift index 1208e02ac..c3690a9e5 100644 --- a/Mac/Preferences/Accounts/AccountsReaderAPIWindowController.swift +++ b/Mac/Preferences/Accounts/AccountsReaderAPIWindowController.swift @@ -94,18 +94,19 @@ class AccountsReaderAPIWindowController: NSWindowController { @IBAction func action(_ sender: Any) { self.errorMessageLabel.stringValue = "" + let apiURLString = apiURLTextField.stringValue guard !usernameTextField.stringValue.isEmpty && !passwordTextField.stringValue.isEmpty else { self.errorMessageLabel.stringValue = NSLocalizedString("Username, password & API URL are required.", comment: "Credentials Error") return } - guard let accountType = accountType, !(accountType == .freshRSS && apiURLTextField.stringValue.isEmpty) else { + guard let accountType = accountType, !(accountType == .freshRSS && apiURLString.isEmpty) else { self.errorMessageLabel.stringValue = NSLocalizedString("Username, password & API URL are required.", comment: "Credentials Error") return } - guard account != nil || !AccountManager.shared.duplicateServiceAccount(type: accountType, username: usernameTextField.stringValue) else { + guard account != nil || !AccountManager.shared.duplicateServiceAccount(type: accountType, username: usernameTextField.stringValue, apiURL: apiURLString) else { self.errorMessageLabel.stringValue = NSLocalizedString("There is already an account of this type with that username created.", comment: "Duplicate Error") return } @@ -113,7 +114,7 @@ class AccountsReaderAPIWindowController: NSWindowController { let apiURL: URL switch accountType { case .freshRSS: - guard let inputURL = URL(string: apiURLTextField.stringValue) else { + guard let inputURL = URL(string: apiURLString) else { self.errorMessageLabel.stringValue = NSLocalizedString("Invalid API URL.", comment: "Invalid API URL") return }