fix(archive): Reorganize never plans a move onto a folder of the exact name, keeps long names' extensions, says why a template is refused
Second fix round of owner review 2, phase 4a (planner findings).
- A sequence keeps a folder that differs from its own in case only while no
other folder holds that exact name (RenamePlanner.ExistsExactly, every level
compared exactly). On a case-sensitive file system a stray "Trip (2)" beside
the sequence at "trip (2)" no longer gives a case-only step that MoveFolder
refuses at every archive open: the plan gives "Trip", and a plan whose
target appeared since is refused under the step's leases before anything
moves (or dropped when it resumes). A change of case in an outer level no
longer looks like two folders on Windows.
- A file name longer than 200 characters is shortened before the ".{ext}" the
template ends with, never through it, so a long title never strips the
photo's extension.
- The archive engine's own settings check applies the template rules the
server and the desktop apply (a folder scans skip, a lost extension, names
that repeat), so archive.json can no longer take such a template.
- The server's invalid_template answer names the rule after the field
("fileTemplate:extension") with the desktop's sentence as its message; both
admin panels show it on the field.
- FrameNaming keeps only the naming overloads production uses.
- Comments about Unreadable say the whole sequence stays as it is.
- Tests pin filing against Reorganize: an upload without a capture time, a
card's second session with {session}, a duplicate skipped mid-session, and a
whole folder of two cameras named with the first one's camera.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 50fe59aec1e180daa1733bcb951892a79dceba6c)
This commit is contained in:
1 parent
9e1f109b58
commit
765f0ad36b
20 files changed
+446
-141
No files matched your search
@@ -90,6 +90,19 @@ public sealed class ArchiveSettingsTests(TestContext context)
|
||||
var template = await Assert.ThrowsAsync<ArgumentException>(() =>
|
||||
fx.Service.UpdateSettingsAsync(fx.Archive.Id, s => s with { Templates = s.Templates with { Folder = "{year/{date" } }, fx.Ct));
|
||||
Assert.Equal("folderTemplate", template.ParamName);
|
||||
// The rules every template is held to wherever it is typed: a folder scans never enter, a lost extension, names that repeat.
|
||||
foreach (var (folder, file, field) in new[]
|
||||
{
|
||||
("exports/{date}", "{n}", "folderTemplate"), ("{date}", "{n}{ext}", "fileTemplate"), ("{date}", "{title}", "fileTemplate"),
|
||||
})
|
||||
{
|
||||
var rule = await Assert.ThrowsAsync<ArgumentException>(() =>
|
||||
fx.Service.UpdateSettingsAsync(fx.Archive.Id, s => s with { Templates = s.Templates with { Folder = folder, File = file } }, fx.Ct));
|
||||
Assert.Equal(field, rule.ParamName, $"{folder} · {file}");
|
||||
}
|
||||
var created = await Assert.ThrowsAsync<ArgumentException>(() =>
|
||||
fx.Service.CreateAsync(context.CreateTempDirectory("other"), "Other", new LayoutTemplates { Folder = "{date}", File = "{n}{ext}" }, null, fx.Ct));
|
||||
Assert.Equal("fileTemplate", created.ParamName);
|
||||
var proxies = await Assert.ThrowsAsync<ArgumentException>(() =>
|
||||
fx.Service.UpdateSettingsAsync(fx.Archive.Id, s => s with { Proxies = s.Proxies with { LongEdge = 100 } }, fx.Ct));
|
||||
Assert.Equal("proxyLongEdge", proxies.ParamName);
|
||||
|
||||
Reference in new issue
Block a user