Review-Korrekturen zu „Kartenimport, Metadaten und Versand absichern“
- Ingest-Verlauf wieder wie PM: Name + Größe + Datum, unabhängig von Ziel und Ordnermuster. Beim Sichten gelöschte Fotos kommen nicht zurück, neuer Spieltags-Ordner importiert keine alte Karte erneut, keine SHA-256-Prüfsumme mehr über die ganze Karte. Alter Verlauf (ingest-history.json) gilt wieder. Schutz vor Namenskollisionen, Rollback und Backup-Prüfung bleiben. - FTP: „Vorhandene Datei auf dem Server ersetzen“ (wie PM, Standard an) – Korrekturen lassen sich erneut senden, kein Auflisten des Server-Ordners vor jeder Datei. Aus = Upload stoppt bei belegtem Namen. - LR-Export: Pfadabgleich unabhängig von Unicode-Schreibweise (Umlaute), Groß/Klein und Symlinks - Ordner-Scan: einzelne unlesbare oder verschwundene Dateien werden übersprungen statt alles abzubrechen - Agentur-Check: Mindestgröße nur für die gelieferten Bilder, RAWs blockieren nicht; Senden nutzt die aktuellen Bilddaten - Datum ohne Uhrzeit lässt IPTC TimeCreated stehen Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012bGzgsxrmbBhDzeMV2L57D
This commit is contained in:
1 parent
427b6fa7b0
commit
c9d43aba9c
11 files changed
+91
-129
No files matched your search
@@ -41,20 +41,25 @@ public struct FTPDestination: Codable, Identifiable, Hashable, Sendable {
|
||||
public var allowInsecureTLS: Bool
|
||||
/// Agentur-Check before uploading to this server
|
||||
public var preflight: Bool
|
||||
/// PM "Replace existing file on server": a corrected image can be sent again under the same name.
|
||||
/// Off = the upload stops if the name already exists there.
|
||||
public var replaceExisting: Bool
|
||||
|
||||
public init(id: UUID = UUID(), name: String = "Neuer Server", proto: FTPProtocol = .ftp, host: String = "",
|
||||
port: Int = 21, username: String = "", remoteDirectory: String = "/", passive: Bool = true,
|
||||
uploadWithTempName: Bool = true, renamePattern: String = "", variant: UploadVariant = .jpeg,
|
||||
sshKeyPath: String = "", allowInsecureTLS: Bool = false, preflight: Bool = true) {
|
||||
sshKeyPath: String = "", allowInsecureTLS: Bool = false, preflight: Bool = true,
|
||||
replaceExisting: Bool = true) {
|
||||
self.id = id; self.name = name; self.proto = proto; self.host = host; self.port = port
|
||||
self.username = username; self.remoteDirectory = remoteDirectory; self.passive = passive
|
||||
self.uploadWithTempName = uploadWithTempName; self.renamePattern = renamePattern; self.variant = variant
|
||||
self.sshKeyPath = sshKeyPath; self.allowInsecureTLS = allowInsecureTLS; self.preflight = preflight
|
||||
self.replaceExisting = replaceExisting
|
||||
}
|
||||
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case id, name, proto, host, port, username, remoteDirectory, passive, uploadWithTempName, renamePattern,
|
||||
variant, sshKeyPath, allowInsecureTLS, preflight
|
||||
variant, sshKeyPath, allowInsecureTLS, preflight, replaceExisting
|
||||
}
|
||||
|
||||
/// Tolerant decoding – new options must never wipe the saved server profiles.
|
||||
@@ -76,6 +81,7 @@ public struct FTPDestination: Codable, Identifiable, Hashable, Sendable {
|
||||
sshKeyPath = v(.sshKeyPath, d.sshKeyPath)
|
||||
allowInsecureTLS = v(.allowInsecureTLS, d.allowInsecureTLS)
|
||||
preflight = v(.preflight, d.preflight)
|
||||
replaceExisting = v(.replaceExisting, d.replaceExisting)
|
||||
}
|
||||
|
||||
public var keychainAccount: String { "ftp-\(id.uuidString)" }
|
||||
@@ -158,8 +164,11 @@ public struct FTPUploader: Sendable {
|
||||
let directory = baseURL(d)
|
||||
let key = directory.lowercased() + name.lowercased()
|
||||
try await Self.reservations.withName(key, name: name) {
|
||||
let names = try await listNames(d, curl: curl, password: password, createDirectories: true)
|
||||
if names.contains(name.lowercased()) { throw UploadError.remoteNameConflict(name) }
|
||||
// only list the server folder when existing files must not be replaced (saves a login per file)
|
||||
if !d.replaceExisting {
|
||||
let names = try await listNames(d, curl: curl, password: password, createDirectories: true)
|
||||
if names.contains(name.lowercased()) { throw UploadError.remoteNameConflict(name) }
|
||||
}
|
||||
try await transfer(file: file, name: name, to: d, curl: curl, password: password, progress: progress)
|
||||
}
|
||||
}
|
||||
@@ -177,8 +186,11 @@ public struct FTPUploader: Sendable {
|
||||
let base = sftpPath(d)
|
||||
let source = Self.configQuote(base + tempName), target = Self.configQuote(base + name)
|
||||
args.insert(contentsOf: ["-Q", "-rename \(source) \(target)"], at: 0)
|
||||
// "*" = ignore the error if there is no old file; some servers refuse renaming onto a file
|
||||
if d.replaceExisting { args.insert(contentsOf: ["-Q", "-*rm \(target)"], at: 0) }
|
||||
} else {
|
||||
args.insert(contentsOf: ["-Q", "-RNFR \(tempName)", "-Q", "-RNTO \(name)"], at: 0)
|
||||
if d.replaceExisting { args.insert(contentsOf: ["-Q", "-*DELE \(name)"], at: 0) }
|
||||
}
|
||||
}
|
||||
let result = try await FTPUploader.runStreaming(curl, args, stdin: credentials(d, password: password)) { line in
|
||||
|
||||
@@ -56,7 +56,8 @@ public enum Preflight {
|
||||
/// Reads the actual upload files without decoding their pixels.
|
||||
static func imageSizeIssues(files: [URL], minimum: Int) -> [PreflightIssue] {
|
||||
guard minimum > 0 else { return [] }
|
||||
return files.compactMap { file in
|
||||
// RAWs are not what the agency gets and ImageIO may not know a new camera yet → only the delivered images
|
||||
return files.filter { !FileKind(url: $0).isRawLike }.compactMap { file in
|
||||
guard let source = CGImageSourceCreateWithURL(file as CFURL, nil),
|
||||
let info = CGImageSourceCopyPropertiesAtIndex(source, 0, nil) as? [CFString: Any],
|
||||
let width = info[kCGImagePropertyPixelWidth] as? Int,
|
||||
|
||||
Reference in new issue
Block a user