From 6e7b7c804c57b9f1d207ec2abc41e21a14f4ac3a Mon Sep 17 00:00:00 2001 From: MapleWheels Date: Mon, 19 Jan 2026 18:00:39 -0500 Subject: [PATCH] - Added other package locations to if statement check. --- .../SharedSource/LuaCs/Services/StorageService.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Barotrauma/BarotraumaShared/SharedSource/LuaCs/Services/StorageService.cs b/Barotrauma/BarotraumaShared/SharedSource/LuaCs/Services/StorageService.cs index 220a6570f..5554fc734 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/LuaCs/Services/StorageService.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/LuaCs/Services/StorageService.cs @@ -3,11 +3,13 @@ using System.Collections.Concurrent; using System.Collections.Generic; using System.Collections.Immutable; using System.IO; +using System.Reflection; using System.Text; using System.Threading; using System.Threading.Tasks; using System.Xml.Linq; using Barotrauma.LuaCs.Data; +using Barotrauma.Networking; using FluentResults; using FluentResults.LuaCs; using Microsoft.Toolkit.Diagnostics; @@ -227,8 +229,17 @@ public class StorageService : IStorageService Guard.IsNotNullOrWhiteSpace(filePath.FullPath, nameof(filePath.FullPath)); using var lck = OperationsLock.AcquireReaderLock().ConfigureAwait(false).GetAwaiter().GetResult(); IService.CheckDisposed(this); - if (!filePath.FullPath.StartsWith(ConfigData.WorkshopModsDirectory) && !filePath.FullPath.StartsWith(ConfigData.LocalModsDirectory)) + if (!filePath.FullPath.StartsWith(ConfigData.WorkshopModsDirectory) + && !filePath.FullPath.StartsWith(ConfigData.LocalModsDirectory) + && !filePath.FullPath.StartsWith(ConfigData.TempDownloadsDirectory) + && !filePath.FullPath.StartsWith(ContentPackageManager.VanillaCorePackage!.Dir) +#if CLIENT + && !filePath.FullPath.StartsWith(ModReceiver.DownloadFolder) +#endif + ) + { ThrowHelper.ThrowUnauthorizedAccessException($"{nameof(LoadPackageData)}: The filepath of `{filePath.FullPath}' is not in a package directory!"); + } return dataLoader(filePath.FullPath); }