diff --git a/Sources/App/CapServer.swift b/Sources/App/CapServer.swift index f976e5b..e3a6d40 100644 --- a/Sources/App/CapServer.swift +++ b/Sources/App/CapServer.swift @@ -203,6 +203,7 @@ final class CapServer { throw CapError.invalidData } caps[cap.id] = cap + log("Added cap \(cap.id) '\(cap.name)'") } private func update(_ existingCap: Cap, with cap: Cap) throws { @@ -210,13 +211,14 @@ final class CapServer { if cap.name != "" { updatedCap.name = cap.name } - let url = file(of: cap.id, version: cap.mainImage) + let url = file(of: existingCap.id, version: cap.mainImage) if fm.fileExists(atPath: url.path) { updatedCap.mainImage = cap.mainImage } if let color = cap.color { updatedCap.color = color } - caps[cap.id] = updatedCap + caps[existingCap.id] = updatedCap + log("Updated cap \(existingCap.id)") } }