From a104365b32d4dda6abb01c39520b2c7d5d2e7856 Mon Sep 17 00:00:00 2001 From: goat <16760685+goaaats@users.noreply.github.com> Date: Wed, 9 Dec 2020 14:23:08 +0100 Subject: [PATCH] fix: edge case for plugin installs with old PM --- Dalamud/Plugin/PluginRepository.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Dalamud/Plugin/PluginRepository.cs b/Dalamud/Plugin/PluginRepository.cs index 293a703c8..d5773a9e8 100644 --- a/Dalamud/Plugin/PluginRepository.cs +++ b/Dalamud/Plugin/PluginRepository.cs @@ -15,6 +15,8 @@ namespace Dalamud.Plugin internal class PluginRepository { private string PluginFunctionBaseUrl => "https://us-central1-xl-functions.cloudfunctions.net/download-plugin/?plugin={0}&isUpdate={1}&isTesting={2}"; private string PluginMasterUrl => "https://raw.githubusercontent.com/goatcorp/DalamudPlugins/master/pluginmaster.json"; + private string PluginJsonUrl = + "https://raw.githubusercontent.com/goatcorp/DalamudPlugins/master/{0}/{1}/{1}.json"; private readonly Dalamud dalamud; @@ -66,6 +68,13 @@ namespace Dalamud.Plugin public bool InstallPlugin(PluginDefinition definition, bool enableAfterInstall = true, bool isUpdate = false, bool fromTesting = false) { try { + using var client = new WebClient(); + + // We need to redownload the json, for the eventuality of the zip having changed after PM download + definition = JsonConvert.DeserializeObject( + client.DownloadString(string.Format(this.PluginJsonUrl, fromTesting ? "testing" : "plugins", + definition.InternalName))); + var outputDir = new DirectoryInfo(Path.Combine(this.pluginDirectory, definition.InternalName, fromTesting ? definition.TestingAssemblyVersion : definition.AssemblyVersion)); var dllFile = new FileInfo(Path.Combine(outputDir.FullName, $"{definition.InternalName}.dll")); var disabledFile = new FileInfo(Path.Combine(outputDir.FullName, ".disabled")); @@ -92,8 +101,6 @@ namespace Dalamud.Plugin } var path = Path.GetTempFileName(); - - using var client = new WebClient(); var doTestingDownload = false; if ((Version.TryParse(definition.TestingAssemblyVersion, out var testingAssemblyVer) || definition.IsTestingExclusive)