fix(settings): archive settings row and file under one lease, decimal ranges, card-only import actions
- The archive's index row is written under the same lease as archive.json, so two edits cannot leave them in opposite orders. - A scanner holding the restore check's scratch copy no longer turns a passed check into a failure. - Night frames and Star fields say "Enter a number" instead of "Enter a whole number". - Folder and server sources start with Keep and no eject whatever Settings › Import says for cards. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
6 files changed
+13
-7
No files matched your search
@@ -177,7 +177,7 @@ public sealed class ArchiveService : IJobHandlerProvider
|
||||
var archive = await LoadArchiveAsync(archiveId, cancellationToken).ConfigureAwait(false);
|
||||
var paths = new ArchivePaths(archive.RootPath);
|
||||
ArchiveVolume.EnsureWritable(paths);
|
||||
ArchiveManifest manifest;
|
||||
// The index row is written under the same lease as the file, so two edits cannot leave them in opposite orders.
|
||||
using (await LeaseFile.AcquireAsync(paths.LocksDirectory, SettingsLease, _writer.Options.Owner, _writer.Options.LeaseWait, _writer.Options.LeaseDuration,
|
||||
cancellationToken).ConfigureAwait(false))
|
||||
{
|
||||
@@ -186,7 +186,7 @@ public sealed class ArchiveService : IJobHandlerProvider
|
||||
// The name read is made usable before the edit sees it; a name the edit sets is checked as given.
|
||||
var settings = edit(WithUsableName(ArchiveSettings.Of(current), paths));
|
||||
if (settings.Problem() is { } field) throw new ArgumentException($"The archive setting {field} is invalid.", field);
|
||||
manifest = current with
|
||||
var manifest = current with
|
||||
{
|
||||
Name = settings.Name.Trim(),
|
||||
LayoutTemplates = settings.Templates,
|
||||
@@ -194,9 +194,9 @@ public sealed class ArchiveService : IJobHandlerProvider
|
||||
ThumbnailPolicy = settings.Thumbnails,
|
||||
};
|
||||
if (manifest != current) ManifestStore.WriteArchive(paths.ManifestPath, manifest);
|
||||
Log.Info("archive", $"Settings of {paths.Root}: {manifest.LayoutTemplates.Folder} · {manifest.LayoutTemplates.File}, proxies {manifest.ProxyPolicy.LongEdge}, thumbnails {manifest.ThumbnailPolicy.LongEdge}");
|
||||
return await RegisterAsync(paths, manifest, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
Log.Info("archive", $"Settings of {paths.Root}: {manifest.LayoutTemplates.Folder} · {manifest.LayoutTemplates.File}, proxies {manifest.ProxyPolicy.LongEdge}, thumbnails {manifest.ThumbnailPolicy.LongEdge}");
|
||||
return await RegisterAsync(paths, manifest, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
public static ArchiveAvailability GetAvailability(Archive archive) => ArchiveVolume.Probe(new ArchivePaths(archive.RootPath));
|
||||
|
||||
@@ -132,8 +132,9 @@ public static partial class DatabaseBackups
|
||||
{
|
||||
Directory.Delete(folder, recursive: true);
|
||||
}
|
||||
catch (IOException ex)
|
||||
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException)
|
||||
{
|
||||
// A scanner can still hold the copy; the checked summary stands.
|
||||
Log.Warning("backup", $"The scratch copy in {folder} was not removed", ex);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user