fix(import): say why a photo was not copied with a catalog sentence
A photo the executor could not copy now carries one localized sentence (ImportExecutor.FailureText: its own checks, a full destination, access denied, else "The photo could not be read or copied.") on the Import screen and in the import job's log. The photos a stopped folder or server import never reached show the stop's cause (ImportFailures.Stop: the server's own sentence, not answering, untrusted certificate, card gone, destination full or not writable), and a failed index check reads "The index could not be read or written.". A refusal without words reads as the catalog's sentence. The system's text stays in the log. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
11 files changed
+132
-17
No files matched your search
@@ -27,7 +27,7 @@ public sealed class ServerImportSinkTests(TestContext context)
|
||||
var plan = await new UnindexedDestination(ImportDestinationKind.Server, staging).PlanAsync(card, new ImportChoices().ToOptions(), null, null, context.Cancellation);
|
||||
plan = plan with { Sessions = [plan.Sessions[0] with { Title = "Harbour sunset" }, .. plan.Sessions.Skip(1)] };
|
||||
|
||||
var outcome = await LocalImport.RunAsync(plan, new ServerImportSink(client, staging), verify: true, null, context.Cancellation);
|
||||
var outcome = await LocalImport.RunAsync(plan, new ServerImportSink(client, staging), "EOS R5 · card A", verify: true, null, context.Cancellation);
|
||||
|
||||
Assert.Equal(16, outcome.Copied);
|
||||
Assert.True(outcome.IsComplete);
|
||||
@@ -55,10 +55,10 @@ public sealed class ServerImportSinkTests(TestContext context)
|
||||
using var client = new TitanoClient(new Uri("https://nas.local:8443/"), new CertificatePinning([]), "tests", server) { Token = "t" };
|
||||
var destination = new UnindexedDestination(ImportDestinationKind.Server, staging);
|
||||
var plan = await destination.PlanAsync(card, new ImportChoices().ToOptions(), null, null, context.Cancellation);
|
||||
await LocalImport.RunAsync(plan, new ServerImportSink(client, staging), verify: true, null, context.Cancellation);
|
||||
await LocalImport.RunAsync(plan, new ServerImportSink(client, staging), "EOS R5 · card A", verify: true, null, context.Cancellation);
|
||||
var chunks = server.ChunkCount;
|
||||
|
||||
var again = await LocalImport.RunAsync(plan, new ServerImportSink(client, staging), verify: true, null, context.Cancellation);
|
||||
var again = await LocalImport.RunAsync(plan, new ServerImportSink(client, staging), "EOS R5 · card A", verify: true, null, context.Cancellation);
|
||||
Assert.Equal(0, again.Copied);
|
||||
Assert.Equal(8, again.Duplicates);
|
||||
Assert.Equal(chunks, server.ChunkCount);
|
||||
@@ -74,7 +74,7 @@ public sealed class ServerImportSinkTests(TestContext context)
|
||||
var plan = await new UnindexedDestination(ImportDestinationKind.Server, staging).PlanAsync(card, new ImportChoices().ToOptions(), null, null, context.Cancellation);
|
||||
var sink = new ServerImportSink(client, staging);
|
||||
|
||||
var outcome = await LocalImport.RunAsync(plan, sink, true, null, context.Cancellation, sink.Report);
|
||||
var outcome = await LocalImport.RunAsync(plan, sink, "EOS R5 · card A", true, null, context.Cancellation, sink.Report);
|
||||
Assert.Equal(7, outcome.Copied);
|
||||
Assert.Equal(7, server.Committed.Count);
|
||||
Assert.Equal(new ImportFailure("DCIM/100CANON/IMG_0003.JPG", "Hash mismatch"), outcome.Failures.Single());
|
||||
@@ -91,7 +91,7 @@ public sealed class ServerImportSinkTests(TestContext context)
|
||||
var plan = await new UnindexedDestination(ImportDestinationKind.Server, staging).PlanAsync(card, new ImportChoices().ToOptions(), null, null, context.Cancellation);
|
||||
var sink = new ServerImportSink(client, staging);
|
||||
|
||||
var outcome = await LocalImport.RunAsync(plan, sink, true, null, context.Cancellation, sink.Report);
|
||||
var outcome = await LocalImport.RunAsync(plan, sink, "EOS R5 · card A", true, null, context.Cancellation, sink.Report);
|
||||
Assert.Equal(3, outcome.Copied, "the uploads the server committed before the sign-in was lost");
|
||||
Assert.Equal(5, outcome.Failures.Count);
|
||||
Assert.Equal("Sign in again", outcome.Failures[0].Message, "the server's sentence");
|
||||
|
||||
Reference in new issue
Block a user