mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-22 08:13:12 +09:00
Derive mod filename from name and version
Enforce the filename of uploaded mods match {name}_{version}.zip with
name and version taken from the zip file's info.json entry. This allows
it to be used as a unique key for the mod and solves part of the issues
with mods having different number of leading zeros in their version.
This commit is contained in:
1 parent
7d34c60dd1
commit
7072b94355
7 files changed
+39
-28
No files matched your search
@@ -507,9 +507,8 @@ async function uploadMod(req, res) {
|
||||
await finished(writeStream);
|
||||
|
||||
const modInfo = await libData.ModInfo.fromModFile(path.join(modsDirectory, tempFilename));
|
||||
modInfo.filename = filename;
|
||||
await fs.rename(path.join(modsDirectory, tempFilename), path.join(modsDirectory, filename));
|
||||
req.app.locals.master.mods.set(`${modInfo.name}_${modInfo.version}`, modInfo);
|
||||
await fs.rename(path.join(modsDirectory, tempFilename), path.join(modsDirectory, modInfo.filename));
|
||||
req.app.locals.master.mods.set(modInfo.filename, modInfo);
|
||||
req.app.locals.master.modUpdated(modInfo);
|
||||
mods.push(modInfo.toJSON());
|
||||
|
||||
|
||||
Reference in new issue
Block a user