Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR removes obsolete networking routers in favor of NextcloudKit and introduces a canonical server address parser to normalize user-provided server URLs (e.g., preventing duplicated /index.php segments).
Changes:
- Added
canonicalServerComponents(from:)and migrated URL building to use it across networking and account setup. - Replaced custom
/status.phprequest logic with NextcloudKit’s server status API. - Removed obsolete
StatusRouter/OCSRouterand related OCS header helper.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| iOCNotes/Views/SettingsView.swift | UI tweak to keep settings title inline. |
| iOCNotes/Store.swift | Uses canonical server components to derive base URL for accounts. |
| iOCNotes.xcodeproj/project.pbxproj | Removes deleted router files from project references/build phases. |
| Utils/UtilityExtensions.swift | Adds canonical server URL parsing helper. |
| Networking/StatusRouter.swift | Deletes obsolete status router code. |
| Networking/ServerStatus.swift | Builds /status.php URL via canonical components (no router). |
| Networking/Router.swift | Builds Notes API base URL via canonical components instead of string concat + asURL(). |
| Networking/OCSRouter.swift | Deletes obsolete OCS router code. |
| Networking/NoteSessionManager.swift | Migrates status fetch to NextcloudKit async API. |
| Networking/HTTPHeader+Extensions.swift | Removes OCS header helper no longer used. |
i2h3
left a comment
There was a problem hiding this comment.
Formatting could be prettier and more comfortable to read but besides that it looks fine to me. 🙂
Can you elaborate? |
/// Returns components for `serverAddress` with any trailing `/index.php` or `/` removed.
/// Handles cases where the address may have been received in a bad format, ex. test.com/nextcloud/index.php/index.php
func canonicalServerComponents(from serverAddress: String) -> URLComponents? {
guard let url = URL(string: serverAddress) else { return nil }
let stripped = url.lastPathComponent == "index.php" ? url.deletingLastPathComponent() : url
guard var components = URLComponents(url: stripped, resolvingAgainstBaseURL: false) else { return nil }
if components.path.hasSuffix("/") {
components.path = String(components.path.dropLast())
}
return components
}///
/// Returns components for `serverAddress` with any trailing `/index.php` or `/` removed.
/// Handles cases where the address may have been received in a bad format, ex. test.com/nextcloud/index.php/index.php
///
func canonicalServerComponents(from serverAddress: String) -> URLComponents? {
guard let url = URL(string: serverAddress) else {
return nil
}
let stripped = url.lastPathComponent == "index.php" ? url.deletingLastPathComponent() : url
guard var components = URLComponents(url: stripped, resolvingAgainstBaseURL: false) else {
return nil
}
if components.path.hasSuffix("/") {
components.path = String(components.path.dropLast())
}
return components
}More blank spaces and line breaks improve orientation by visually identifying scopes and structures more quickly. But that is just my taste and preferred way of reading. As mentioned earlier, nothing that blocks the pull request. 😉 |
Potentially fixes:
#185
#171
#161
#146