Address review of save transfer and instance dir naming

Instance dir and save names are tried without a retry cap, as on master
and in downloadFile, so an 11th instance named "New Instance" still gets
a folder.

Moves fall back to an exclusive copy when hard links are unavailable
(EXDEV, EPERM, ENOTSUP), and remove the new target if the source can't
be unlinked, so a failed move leaves no duplicate.

Local transfers keep appending .zip to the target name, as
findUnusedName did.

The copy auto-rename test now checks that the existing target save is
left untouched.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
bbassieandClaude Opus 5.5 authored and Cooldude2606 committed 2026-10-24 00:22:17 +01:00
1 parent a6d2d48e48
commit e16d0bc410
2 files changed
+43 -16

No files matched your search

+3 -2
View File
@@ -1471,10 +1471,11 @@ describe("Integration of Clusterio", function() {
});
it("should auto-rename copy if target exists", async function() {
await uploadSave(pri, "transfer.zip", "transfer.zip");
await uploadSave(sec, "transfer.zip", "transfer.zip");
await uploadSave(sec, "transfer.zip", "existing");
await execCtlProcess(`instance save transfer ${pri} transfer.zip ${sec} --copy`);
await assert.doesNotReject(fs.access(path.join(priSaves, "transfer.zip")), "save not at pri");
await assert.doesNotReject(fs.access(path.join(secSaves, "transfer-2.zip")), "save not at sec");
assert.equal(await fs.readFile(path.join(secSaves, "transfer.zip"), "utf8"), "existing");
assert.equal(await fs.readFile(path.join(secSaves, "transfer-2.zip"), "utf8"), "transfer.zip");
await deleteSave(pri, "transfer.zip");
await deleteSave(sec, "transfer.zip");
await deleteSave(sec, "transfer-2.zip");