diff options
author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2023-01-29 16:37:23 -0500 |
---|---|---|
committer | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2023-01-29 16:37:23 -0500 |
commit | 3eb98b565f48c26384f0e83e4012fc9b40f1d819 (patch) | |
tree | f88ae302c3b0913228fb18dcd2a2babf14134ada /src/SMAPI.Web/Framework/Clients/UpdateManifest/UpdateManifestClient.cs | |
parent | 610e2722c6687591faacb942d6f752c5f3c620d7 (diff) | |
download | SMAPI-3eb98b565f48c26384f0e83e4012fc9b40f1d819.tar.gz SMAPI-3eb98b565f48c26384f0e83e4012fc9b40f1d819.tar.bz2 SMAPI-3eb98b565f48c26384f0e83e4012fc9b40f1d819.zip |
simplify & validate manifest mod page URLs
This avoids an issue where users are told to download it from the JSON manifest URL.
Diffstat (limited to 'src/SMAPI.Web/Framework/Clients/UpdateManifest/UpdateManifestClient.cs')
-rw-r--r-- | src/SMAPI.Web/Framework/Clients/UpdateManifest/UpdateManifestClient.cs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/SMAPI.Web/Framework/Clients/UpdateManifest/UpdateManifestClient.cs b/src/SMAPI.Web/Framework/Clients/UpdateManifest/UpdateManifestClient.cs index cd102ec5..9a2887c2 100644 --- a/src/SMAPI.Web/Framework/Clients/UpdateManifest/UpdateManifestClient.cs +++ b/src/SMAPI.Web/Framework/Clients/UpdateManifest/UpdateManifestClient.cs @@ -72,6 +72,17 @@ namespace StardewModdingAPI.Web.Framework.Clients.UpdateManifest // validate if (!SemanticVersion.TryParse(manifest.Format, out _)) return new GenericModPage(this.SiteKey, id).SetError(RemoteModStatus.InvalidData, $"The update manifest at {id} has invalid format version '{manifest.Format}'"); + foreach ((string modKey, UpdateManifestModModel mod) in manifest.Mods) + { + if (string.IsNullOrWhiteSpace(mod.ModPageUrl)) + { + foreach (UpdateManifestVersionModel download in mod.Versions) + { + if (string.IsNullOrWhiteSpace(download.ModPageUrl)) + return new GenericModPage(this.SiteKey, id).SetError(RemoteModStatus.InvalidData, $"The update manifest at {id} is invalid (all mod downloads must have a mod page URL)"); + } + } + } // build model return new UpdateManifestModPage(id, manifest); |