fix(archive): a case-only target that is the sequence's own folder is kept; stored templates never fail other edits
Reorganize refused a case-only folder target whenever a folder of that exact name was on disk. On a case-insensitive file system that folder can be the sequence's own, when the disk spells it as the template does and the index does not (renamed in Explorer, or an outer level a change of case left as it was), so the plan gave a needless " (n)" folder. RenamePlanner.Kept now refuses only when both exact names exist, the condition MassRenamer.TargetTaken and MoveFolder already use. ArchiveSettings.Problem held both templates to the template rules on every UpdateSettingsAsync, so an archive.json saved before the rules made every desktop Settings > Archive edit fail. A template the file already holds is now only checked for being usable; a template the edit gives, and both templates of a new archive, meet every rule. A broken rule throws TemplateRuleException (an ArgumentException naming the field), and the desktop toast shows that rule's sentence instead of "Something went wrong". Also corrects comments that ignored RenameBlock.Unreadable (the whole sequence stays as it is) and the ARCHITECTURE Naming row. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit ac7a0c36df83b6d43651caf0225c530466242c97)
This commit is contained in:
1 parent
8127373fd5
commit
0377040a19
13 files changed
+193
-31
No files matched your search
@@ -166,7 +166,7 @@
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
<!-- Photos that keep their names, each line with why. -->
|
||||
<!-- Photos that keep their names, each line with why; or why the whole sequence stays as it is. -->
|
||||
<ItemsControl ItemsSource="{Binding Kept}" Focusable="False" Visibility="{Binding HasKept, Converter={StaticResource BoolToVisibility}}">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
|
||||
@@ -20,7 +20,8 @@ public sealed record ReorganizeLine(string Label, string From, string To, bool I
|
||||
|
||||
/// <summary>
|
||||
/// One sequence of the Reorganize dry run: its name, what concerns it as a whole (it follows its folder, how many of its
|
||||
/// files get a new name), its changes (the first renamed files as samples) and the photos that keep their names, with why.
|
||||
/// files get a new name), its changes (the first renamed files as samples) and the photos that keep their names, with why,
|
||||
/// or why the whole sequence stays as it is.
|
||||
/// </summary>
|
||||
/// <param name="IsNamePath">The sequence has no title: <paramref name="Name"/> is its folder, read left to right.</param>
|
||||
public sealed record ReorganizeRow(Guid SequenceId, string Name, bool IsNamePath, string Note, IReadOnlyList<ReorganizeLine> Lines, IReadOnlyList<string> Kept)
|
||||
@@ -70,7 +71,10 @@ public static class ReorganizePlans
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>The rows of a plan, in the order it applies them; a step that changes nothing lists why photos keep their names.</summary>
|
||||
/// <summary>
|
||||
/// The rows of a plan, in the order it applies them; a step that changes nothing lists why photos keep their names, or
|
||||
/// why the whole sequence stays as it is.
|
||||
/// </summary>
|
||||
public static IReadOnlyList<ReorganizeRow> Rows(RenamePlan plan) => [.. plan.Steps.Where(s => s.Changes || s.Blocked.Count > 0).Select(Row)];
|
||||
|
||||
public static ReorganizeRow Row(RenameStep step)
|
||||
|
||||
@@ -42,6 +42,8 @@ public static class ErrorText
|
||||
{
|
||||
LeaseUnavailableException or ArchiveOfflineException or NewerFormatException or ImportSourceUnavailableException
|
||||
or CopyVerificationException or StaleRenamePlanException or SyncConflictChangedException => ex.Message,
|
||||
// A template an archive refused (Settings › Archive, or this PC's templates for a new archive): the rule it breaks.
|
||||
TemplateRuleException rule => Loc.L("Errors.Template." + rule.Rule),
|
||||
// The server words its errors in the client's language (Accept-Language).
|
||||
ChronosApiException api when FromServer(api.Error) => api.Error.Message,
|
||||
// Any other reply (a reverse proxy's 502 page while the server restarts, its 413 for a large body, a bare 500) holds
|
||||
|
||||
Reference in new issue
Block a user