Skip to content

Commit cc2d914

Browse files
committed
Fix transversal path on empty asset install
1 parent 443a146 commit cc2d914

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Hi3Helper.Plugin.HBR/Management/HBRGameInstaller.InstallOrUpdate.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,12 @@ private static void SkipBlankAssets(string gamePath, List<GameInstallAsset> game
146146
{
147147
if (asset.AssetSize == 0)
148148
{
149-
FileInfo fileInfo = new(Path.Combine(gamePath, asset.AssetPath ?? ""));
149+
string normalizedRelPath = asset.AssetPath
150+
.AsSpan()
151+
.Trim("/\\")
152+
.ToString();
153+
154+
FileInfo fileInfo = new(Path.Combine(gamePath, normalizedRelPath));
150155
fileInfo.Directory?.Create();
151156

152157
if (fileInfo is { Exists: true, Length: 0 })

0 commit comments

Comments
 (0)