Skip to content

Commit 87291c1

Browse files
authored
fix: Workaround for grabbing download-url, in case it's missing from the mod file data.
1 parent 980a014 commit 87291c1

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

CurseForge.Minecraft.Serverpack.Launcher/Dependencies.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,18 @@ private static async Task DownloadMinecraftLibraries(ApiClient cfApiClient, stri
7070
foreach (var file in manifest.Files)
7171
{
7272
var mod = await cfApiClient.GetModFileAsync((int)file.ProjectId, (int)file.FileId);
73+
var modDlUrl = mod.Data.DownloadUrl;
74+
if(string.IsNullOrWhiteSpace(modDlUrl))
75+
{
76+
modDlUrl = await cfApiClient.GetModFileDownloadUrlAsync((int)file.ProjectId, (int)file.FileId);
77+
}
78+
79+
if(string.IsNullOrWhiteSpace(modDlUrl))
80+
{
81+
AnsiConsole.WriteLine($"[red]Could not find a download URL for the mod {mod.Data.DisplayName}, aborting[/]");
82+
throw new Exception("Missing download URL for mod");
83+
}
84+
7385
var modPath = Path.Combine(installPath, "mods", mod.Data.FileName);
7486
Directory.CreateDirectory(Path.GetDirectoryName(modPath));
7587
if (!File.Exists(modPath))

0 commit comments

Comments
 (0)