Added 2.0 zip file name to version matcher (#671)

* Added 2.0 zip file name to version matcher

Fixes: Install problem ? #668

* Add changelog entry for 671.
This commit is contained in:
Cooldude2606 authored and GitHub committed 2024-10-27 22:53:34 +00:00
1 parent 9d18d18603
commit c31671d1e6
2 files changed
+6 -1

No files matched your search

+5 -1
View File
@@ -746,7 +746,11 @@ async function downloadLinuxServer() {
const url = new URL(res.headers.location);
// get the filename of the latest factorio archive from redirected url
const filename = path.posix.basename(url.pathname);
const version = filename.match(/(?<=factorio_headless_x64_).*(?=\.tar\.xz)/)[0];
const match = filename.match(/(?<=factorio_headless_x64_|factorio-headless_linux_)\d+\.\d+\.\d+(?=\.tar\.xz)/);
if (!match || !match.length) {
throw Error(`Unable to extract version from filename: ${filename}`);
}
const version = match[0];
const tmpDir = "temp/create-temp/";
const archivePath = tmpDir + filename;