mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-15 23:24:52 +09:00
Add .json files to symlinkMods whitelist (#365)
This commit is contained in:
1 parent
53edd7cce6
commit
19259b2226
2 files changed
+4
-1
No files matched your search
@@ -1465,7 +1465,7 @@ async function symlinkMods(instance, sharedMods) {
|
||||
let instanceModsEntries = new Set(await fs.readdir(instance.path("mods")));
|
||||
for (let entry of await fs.readdir(sharedMods, { withFileTypes: true })) {
|
||||
if (entry.isFile()) {
|
||||
if ([".zip", ".dat"].includes(path.extname(entry.name))) {
|
||||
if ([".zip", ".dat", ".json"].includes(path.extname(entry.name))) {
|
||||
if (!instanceModsEntries.has(entry.name)) {
|
||||
instance.logger.verbose(`linking ${entry.name} from ${sharedMods}`);
|
||||
let target = path.join(sharedMods, entry.name);
|
||||
|
||||
@@ -95,6 +95,7 @@ describe("Slave testing", function() {
|
||||
await fs.outputFile(path.join(testDir, "shared", "mod_a.zip"), "a");
|
||||
await fs.outputFile(path.join(testDir, "shared", "mod_b.zip"), "b");
|
||||
await fs.outputFile(path.join(testDir, "shared", "mod.dat"), "c");
|
||||
await fs.outputFile(path.join(testDir, "shared", "mod-list.json"), "d");
|
||||
|
||||
let instanceConfig = new libConfig.InstanceConfig("slave");
|
||||
await instanceConfig.init();
|
||||
@@ -111,6 +112,7 @@ describe("Slave testing", function() {
|
||||
assert.equal(await fs.readFile(instance.path("mods", "mod_a.zip"), "utf-8"), "a");
|
||||
assert.equal(await fs.readFile(instance.path("mods", "mod_b.zip"), "utf-8"), "b");
|
||||
assert.equal(await fs.readFile(instance.path("mods", "mod.dat"), "utf-8"), "c");
|
||||
assert.equal(await fs.readFile(instance.path("mods", "mod-list.json"), "utf-8"), "d");
|
||||
assert.equal(await fs.readFile(instance.path("mods", "mod_i.zip"), "utf-8"), "i");
|
||||
});
|
||||
|
||||
@@ -140,6 +142,7 @@ describe("Slave testing", function() {
|
||||
await assert.rejects(fs.lstat(instance.path("mods", "mod_a.zip")), { code: "ENOENT" });
|
||||
assert.equal(await fs.readFile(instance.path("mods", "mod_b.zip"), "utf-8"), "b");
|
||||
assert.equal(await fs.readFile(instance.path("mods", "mod.dat"), "utf-8"), "c");
|
||||
assert.equal(await fs.readFile(instance.path("mods", "mod-list.json"), "utf-8"), "d");
|
||||
assert.equal(await fs.readFile(instance.path("mods", "mod_i.zip"), "utf-8"), "i");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user