Skip to content

Commit

Permalink
Fix firefox download
Browse files Browse the repository at this point in the history
  • Loading branch information
kblok committed Jan 17, 2025
1 parent 81e3373 commit a94a5f7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion lib/PuppeteerSharp/BrowserData/Firefox.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text.Json;
Expand Down Expand Up @@ -181,12 +182,18 @@ private static string GetFirefoxPlatform(Platform platform)
private static string GetArchiveNightly(Platform platform, string buildId)
=> platform switch
{
Platform.Linux => $"firefox-{buildId}.en-US.{GetFirefoxPlatform(platform)}-x86_64.tar.bz2",
Platform.Linux => $"firefox-{buildId}.en-US.{GetFirefoxPlatform(platform)}-x86_64.tar.{GetFormat(buildId)}",
Platform.MacOS or Platform.MacOSArm64 => $"firefox-{buildId}.en-US.mac.dmg",
Platform.Win32 or Platform.Win64 => $"firefox-{buildId}.en-US.{GetFirefoxPlatform(platform)}.zip",
_ => throw new PuppeteerException($"Unknown platform: {platform}"),
};

private static string GetFormat(string buildId)
{
var majorVersion = int.Parse(buildId.Split('.')[0], CultureInfo.CurrentCulture);
return majorVersion >= 135 ? "xz" : "bz2";
}

private static string GetArchive(Platform platform, string buildId)
=> platform switch
{
Expand Down
2 changes: 1 addition & 1 deletion lib/PuppeteerSharp/BrowserFetcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ private async Task UnpackArchiveAsync(string archivePath, string outputPath, str
{
ExecuteSetup(archivePath, outputPath);
}
else if (archivePath.EndsWith(".tar.bz2", StringComparison.OrdinalIgnoreCase))
else if (archivePath.Contains(".tar."))
{
ExtractTar(archivePath, outputPath);
}
Expand Down

0 comments on commit a94a5f7

Please sign in to comment.