From b291f7b606350db12063f68182f65e8048c7752a Mon Sep 17 00:00:00 2001 From: Theodore Dubois Date: Sun, 27 Sep 2020 13:56:54 -0700 Subject: [PATCH] Add https:// to a source URL if you forget the scheme (#361) --- AltStore/Sources/SourcesViewController.swift | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/AltStore/Sources/SourcesViewController.swift b/AltStore/Sources/SourcesViewController.swift index d62a03ae..2497a240 100644 --- a/AltStore/Sources/SourcesViewController.swift +++ b/AltStore/Sources/SourcesViewController.swift @@ -106,7 +106,12 @@ private extension SourcesViewController } alertController.addAction(.cancel) alertController.addAction(UIAlertAction(title: NSLocalizedString("Add", comment: ""), style: .default) { (action) in - guard let text = alertController.textFields![0].text, let sourceURL = URL(string: text) else { return } + guard let text = alertController.textFields![0].text else { return } + guard var sourceURL = URL(string: text) else { return } + if sourceURL.scheme == nil { + guard let httpsSourceURL = URL(string: "https://" + text) else { return } + sourceURL = httpsSourceURL + } self.addSource(url: sourceURL) })