Fix loading bundles from different local folders (!270)

Return a full path to the request for getBundles if running locally

Ran into this while working on updating Gilded Key Storage, looks like bundle files are expected to live in the same local folder as the client any time the server address is `127.0.0.1` or `localhost`.

While working in VSCode for the server, and a different folder for the client, this causes issues trying to work on mods that add bundles, as the server only passes a relative path back to the client

This PR resolves that by returning the full path to bundles when running locally

Co-authored-by: DrakiaXYZ <565558+TheDgtl@users.noreply.github.com>
Reviewed-on: https://dev.sp-tarkov.com/SPT-AKI/Server/pulls/270
Co-authored-by: DrakiaXYZ <drakiaxyz@noreply.dev.sp-tarkov.com>
Co-committed-by: DrakiaXYZ <drakiaxyz@noreply.dev.sp-tarkov.com>
This commit is contained in:
DrakiaXYZ 2024-03-25 08:30:41 +00:00 committed by chomp
parent cd8d6eaecf
commit 757c4506f5

View File

@ -1,5 +1,6 @@
import { inject, injectable } from "tsyringe";
import path from "path";
import { HttpServerHelper } from "@spt-aki/helpers/HttpServerHelper";
import { JsonUtil } from "@spt-aki/utils/JsonUtil";
import { VFS } from "@spt-aki/utils/VFS";
@ -55,7 +56,7 @@ export class BundleLoader
if (local)
{
bundle.path = bundle.filepath;
bundle.path = path.join(process.cwd(), bundle.filepath);
}
delete bundle.filepath;