fix: don't crash the background notification poll on an invalid instance URL (#54)

This commit is contained in:
systemBlue 2026-06-04 13:00:25 +02:00 committed by secana
parent 639812348b
commit 4f6803cc03

View file

@ -87,7 +87,9 @@ final class BackgroundDownloadManager: NSObject, Sendable {
for: instance.serverURL, username: instance.username, for: instance.serverURL, username: instance.username,
) else { return nil } ) else { return nil }
var components = URLComponents(string: "\(instance.serverURL)/api/v1/notifications")! guard var components = URLComponents(string: "\(instance.serverURL)/api/v1/notifications") else {
return nil
}
components.queryItems = [ components.queryItems = [
URLQueryItem(name: "status-types", value: "unread"), URLQueryItem(name: "status-types", value: "unread"),
URLQueryItem(name: "page", value: "1"), URLQueryItem(name: "page", value: "1"),