mirror of
https://github.com/passepartoutvpn/wireguard-apple.git
synced 2025-01-17 22:09:06 +00:00
Importing: Error out on file with unsupported file extension
Signed-off-by: Roopesh Chander <roop@roopc.net>
This commit is contained in:
parent
0a55a284d5
commit
3496adca86
@ -240,6 +240,8 @@ class TunnelsListTableViewController: UIViewController {
|
||||
self?.showErrorAlert(title: "Created \(numberSuccessful) tunnels",
|
||||
message: "Created \(numberSuccessful) of \(unarchivedFiles.count) tunnels from zip archive")
|
||||
}
|
||||
} else {
|
||||
fatalError("Unsupported file extension")
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -249,7 +251,13 @@ class TunnelsListTableViewController: UIViewController {
|
||||
extension TunnelsListTableViewController: UIDocumentPickerDelegate {
|
||||
func documentPicker(_ controller: UIDocumentPickerViewController, didPickDocumentsAt urls: [URL]) {
|
||||
if let url = urls.first {
|
||||
importFromFile(url: url)
|
||||
if (url.pathExtension == "conf" || url.pathExtension == "zip") {
|
||||
importFromFile(url: url)
|
||||
} else {
|
||||
// What if a file provider extension didn't respect our 'documentTypes' parameter
|
||||
self.showErrorAlert(title: "Invalid file extension",
|
||||
message: "Please select a WireGuard configuration file (.conf) or a zip archive (.zip) for importing")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user