Skip to content

Commit

Permalink
Add modal if there are duplicate certificates (#250)
Browse files Browse the repository at this point in the history
* Remove unused variable

* Add ambiguous certificate modal
  • Loading branch information
dnicolson authored Nov 4, 2024
1 parent beff6d9 commit 8d3f6be
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions AppSigner/MainView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,6 @@ class MainView: NSView, URLSessionDataDelegate, URLSessionDelegate, URLSessionDo
}
let rawResult = securityResult.output.components(separatedBy: "\"")

var index: Int

for index in stride(from: 0, through: rawResult.count - 2, by: 2) {
if !(rawResult.count - 1 < index + 1) {
output.append(rawResult[index+1])
Expand Down Expand Up @@ -512,6 +510,15 @@ class MainView: NSView, URLSessionDataDelegate, URLSessionDelegate, URLSessionDo
let codesignTask = Process().execute(codesignPath, workingDirectory: nil, arguments: arguments)
if codesignTask.status != 0 {
Log.write("Error codesign: \(codesignTask.output)")

if (codesignTask.output.contains("ambiguous")) {
let alert = NSAlert()
alert.messageText = "Codesign failed due to ambiguous certificates"
alert.informativeText = "\(codesignTask.output)\nOpen Keychain Access and remove the duplicate certificates."
alert.alertStyle = .warning
alert.addButton(withTitle: "OK")
alert.runModal()
}
}

if let afterFunc = after {
Expand Down

0 comments on commit 8d3f6be

Please sign in to comment.