Skip to content

Commit

Permalink
refactor: only check if a zip is attached
Browse files Browse the repository at this point in the history
only check if a zip is attached, as stated in the pre-existing comment.
  • Loading branch information
revam committed Oct 20, 2024
1 parent 808d7ae commit 32ae459
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
4 changes: 1 addition & 3 deletions Shoko.Server/API/WebUI/WebUIHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,8 @@ public static void GetUrlAndUpdate(string tagName)
foreach (var assets in release.assets)
{
// We don't care what the zip is named, only that it is attached.
// This is because we changed the signature from "latest.zip" to
// "Shoko-WebUI-{obj.tag_name}.zip" in the upgrade to web ui v2
string fileName = assets.name;
if (fileName == "latest.zip" || fileName == $"Shoko-WebUI-{release.tag_name}.zip")
if (Path.GetExtension(fileName) is ".zip")
{
url = assets.browser_download_url;
break;
Expand Down
4 changes: 1 addition & 3 deletions Shoko.Server/API/v3/Controllers/WebUIController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -483,10 +483,8 @@ public ActionResult<ComponentVersion> LatestWebUIVersion([FromQuery] ReleaseChan
foreach (var asset in release.assets)
{
// We don't care what the zip is named, only that it is attached.
// This is because we changed the signature from "latest.zip" to
// "Shoko-WebUI-{obj.tag_name}.zip" in the upgrade to web ui v2
string fileName = asset.name;
if (fileName == "latest.zip" || fileName == $"Shoko-WebUI-{tagName}.zip")
if (Path.GetExtension(fileName) is ".zip")
{
var tag = WebUIHelper.DownloadApiResponse($"git/ref/tags/{tagName}");
string commit = tag["object"].sha;
Expand Down

0 comments on commit 32ae459

Please sign in to comment.